1 Preparations

1.1 Load data

# list filenames
file1_list <- list.files(file.path("data", "1"), pattern = "*.xlsx", full.names = TRUE)
file2_list <- list.files(file.path("data", "2"), pattern = "*.xlsx", full.names = TRUE)

# load data
df_raw_E1 <- sapply(file1_list, read_excel, na = "NA", simplify = FALSE) %>% bind_rows(.id = "id") 
df_raw_E2 <- sapply(file2_list, read_excel, na = "NA", simplify = FALSE) %>% bind_rows(.id = "id")
  
# combine data from the two experiments
df_raw_E1_temp <- df_raw_E1 %>% 
  select(-c(SubTrial)) %>% 
  mutate(Probability = 0.5,
         targetDuration = 200, # fix a bug in exp
         Participant = Participant + 100)

df_raw_E2_temp <- df_raw_E2 %>% 
  select(-c(Age, Gender, Ethnicity, Block, FaceIndex)) %>% 
  mutate(Participant = Participant + 200,
         Probability = if_else(grepl("75TopCue", Experiment), 0.75, 0.25))

df_raw <- bind_rows(df_raw_E1_temp, df_raw_E2_temp)
  
str(df_raw)
## tibble[,22] [61,440 × 22] (S3: tbl_df/tbl/data.frame)
##  $ id            : chr [1:61440] "data/1/1_505_CF_Complete_Cue_2_2019-06-24-1519.xlsx" "data/1/1_505_CF_Complete_Cue_2_2019-06-24-1519.xlsx" "data/1/1_505_CF_Complete_Cue_2_2019-06-24-1519.xlsx" "data/1/1_505_CF_Complete_Cue_2_2019-06-24-1519.xlsx" ...
##  $ Experiment    : chr [1:61440] "109_cue" "109_cue" "109_cue" "109_cue" ...
##  $ Participant   : num [1:61440] 101 101 101 101 101 101 101 101 101 101 ...
##  $ Trial         : num [1:61440] 1 2 3 4 5 6 7 8 9 10 ...
##  $ Condition     : chr [1:61440] "Complete_cue" "Complete_cue" "Complete_cue" "Complete_cue" ...
##  $ CuedHalf      : chr [1:61440] "T" "T" "B" "B" ...
##  $ Congruency    : chr [1:61440] "I" "C" "I" "C" ...
##  $ Alignment     : chr [1:61440] "A" "M" "M" "M" ...
##  $ SameDifferent : chr [1:61440] "S" "D" "D" "S" ...
##  $ FaceGroup     : chr [1:61440] "M5" "M1" "M3" "M1" ...
##  $ StudyUpper    : chr [1:61440] "M5116.png" "M1110.png" "M3174.png" "M1119.png" ...
##  $ StudyLower    : chr [1:61440] "M5185.png" "M1119.png" "M3138.png" "M1190.png" ...
##  $ TargetUpper   : chr [1:61440] "M5116.png" "M1190.png" "M3174.png" "M1119.png" ...
##  $ TargetLower   : chr [1:61440] "M5126.png" "M1173.png" "M3124.png" "M1190.png" ...
##  $ thisResponse  : chr [1:61440] "D" "D" "D" "D" ...
##  $ isCorrect     : num [1:61440] 0 1 1 0 1 1 1 1 1 1 ...
##  $ reactionTime  : num [1:61440] 0.755 0.634 1.311 0.999 1.376 ...
##  $ studyDuration : num [1:61440] 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 ...
##  $ targetDuration: num [1:61440] 200 200 200 200 200 200 200 200 200 200 ...
##  $ maskDuration  : num [1:61440] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ...
##  $ trialEndTime  : chr [1:61440] "2019-06-24-15:20:04" "2019-06-24-15:20:07" "2019-06-24-15:20:11" "2019-06-24-15:20:15" ...
##  $ Probability   : num [1:61440] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ...

1.2 Tidy data

df_tidy <- df_raw %>% 
  filter(!is.na(thisResponse)) %>%  # remove NA trials based on responses
  mutate(Cue = if_else(CuedHalf == "T", "top", "bottom"),
         Congruency = if_else(Congruency == "C", "congruent", "incongruent"),
         Alignment = if_else(Alignment == "A", "aligned", "misaligned"),
         SameDifferent = if_else(SameDifferent == "S", "same", "different"),
         Participant = as_factor(Participant),
         Cue = factor(Cue, levels = c("top", "bottom")),
         Congruency = factor(Congruency, levels = c("congruent", "incongruent")),
         Alignment = as_factor(Alignment),
         SameDifferent = factor(SameDifferent, levels = c("same", "different")),
         Probability = as_factor(Probability),
         Resp = if_else(thisResponse == "S", 1, 0),
         RT = round(reactionTime * 1000+200)) # plus the duration of target faces
  • Cue: top vs. bottom
  • Congruency: congruent vs. incongruent
  • Alignment: aligned vs. misaligned
  • Identity (SameDifferent): same vs. different

Number of trials for each participant:

# Trial numbers in each condition
df_tidy %>% 
  group_by(Participant) %>% 
  summarize(nTotal = n()) 
## # A tibble: 64 x 2
##    Participant nTotal
##    <fct>        <int>
##  1 101            640
##  2 102            640
##  3 103            640
##  4 104            640
##  5 105            640
##  6 106            640
##  7 107            640
##  8 108            640
##  9 109            639
## 10 110            640
## # … with 54 more rows
# For 3 participants in E1, one trail was removed due to no response recorded.
# set successive difference coding for fixed effects
contrasts(df_tidy$Cue) <- MASS::contr.sdif(nlevels(df_tidy$Cue)) 
contrasts(df_tidy$Congruency) <- MASS::contr.sdif(nlevels(df_tidy$Congruency)) 
contrasts(df_tidy$Alignment) <- MASS::contr.sdif(nlevels(df_tidy$Alignment))
contrasts(df_tidy$SameDifferent) <- MASS::contr.sdif(nlevels(df_tidy$SameDifferent))

# set successive difference coding for random effects
df_lmm <- df_tidy %>% 
  mutate(
    Cue_C = if_else(Cue == "top", -.5, .5),
    Con_C = if_else(Congruency == "congruent", -.5, .5),
    Ali_C = if_else(Alignment == "aligned", -.5, .5),
    Sam_C = if_else(SameDifferent == "same", -.5, .5),
    
    Cue_Con = Cue_C * Con_C,
    Cue_Ali = Cue_C * Ali_C,
    Cue_Sam = Cue_C * Sam_C,
    Con_Ali = Con_C * Ali_C,
    Con_Sam = Con_C * Sam_C,
    Ali_Sam = Ali_C * Sam_C,
    
    Cue_Con_Ali = Cue_Con * Ali_C,
    Cue_Con_Sam = Cue_Con * Sam_C,
    Cue_Ali_Sam = Cue_Ali * Sam_C,
    Con_Ali_Sam = Con_Ali * Sam_C,
    
    Cue_Con_Ali_Sam = Cue_Con_Ali * Sam_C
  )

# save the data (for fitting model in cluster)
# save(df_lmm, file = file.path("data", "df_lmm.RData"))

1.3 Steps to obtain the optimal model

  1. If the maximal model did not converge, correlations between random effects were removed, making the zero-correlation-parameter (ZCP) model.
  2. Principal component analysis implemented with “rePCA()” function was then used to identify random effects that explained less than 0.1% of the total variances; they were removed from the ZCP model to make the reduced model.
  3. The extended model was built by adding back the correlations between random effects in the reduced model.
  4. If the extended model did not converge, the random effects that explained less than 1% of total variances were identified by “rePCA()” and removed to make the updated extended model; this step was iterated until an extended model converged.
  5. The converged extended model was then compared to the reduced model via “anova()” function and the model that explained the data better (with smaller Bayesian Information Criterion) was used as the optimal model.
  6. All follow-up analyses were performed on the optimal model.

2 Experiment 1

df_lmm_E1 <- df_lmm %>% 
  filter(Experiment == "109_cue") %>% 
  droplevels()

# save(df_lmm_E1, file = file.path("data", "df_lmm_E1.RData"))

There were 32 participants in Experiment 1.

2.1 Response (d’)

2.1.1 Fitting the generalized mixed models

2.1.1.1 The maximal model

# file_E1_resp_max <- file.path(folder_lmm, "E1_Resp_lmm_max.RData")
# 
# # fit the max model
# if (!file.exists(file_E1_resp_max)) {
#   glmm_E1_resp_max <- glmer(
#     Resp ~ Cue * Congruency * Alignment * SameDifferent + 
#       (Cue * Congruency * Alignment * SameDifferent | Participant), # Con_Ali_Sam
#     family = binomial(link = "probit"),
#     data = df_lmm_E1,
#     control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
#                            optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
#   )
# 
#   save(glmm_E1_resp_max, file = file_E1_resp_max)
# } else {
#   load(file_E1_resp_max)
# }
# 
# print(summary(glmm_E1_resp_max), corr = FALSE)

2.1.1.2 The zero-correlation-parameter model

file_E1_resp_zcp <- file.path(folder_lmm, "E1_Resp_lmm_zcp.RData")

# fit the zcp model
if (!file.exists(file_E1_resp_zcp)) {
  glmm_E1_resp_zcp <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent + 
      (Cue_C + Con_C + Ali_C + Sam_C + 
         Cue_Con + Cue_Ali + Cue_Sam + Con_Ali + Con_Sam + Ali_Sam +
         Cue_Con_Ali + Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam + 
         Cue_Con_Ali_Sam || Participant),
    family = binomial(link = "probit"),
    data = df_lmm_E1,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  
  # save(glmm_E1_resp_zcp, file = file_E1_resp_zcp)
} else {
  load(file_E1_resp_zcp)
}

print(summary(glmm_E1_resp_zcp), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + (Cue_C +      Con_C + Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam + Con_Ali +      Con_Sam + Ali_Sam + Cue_Con_Ali + Cue_Con_Sam + Cue_Ali_Sam +      Con_Ali_Sam + Cue_Con_Ali_Sam || Participant)
##    Data: df_lmm_E1
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  21936.9  22190.5 -10936.4  21872.9    20445 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -6.9358 -0.6657  0.2593  0.6445  4.4998 
## 
## Random effects:
##  Groups         Name            Variance  Std.Dev. 
##  Participant    (Intercept)     6.780e-02 0.2603885
##  Participant.1  Cue_C           1.182e-01 0.3438058
##  Participant.2  Con_C           3.893e-03 0.0623954
##  Participant.3  Ali_C           4.835e-02 0.2198965
##  Participant.4  Sam_C           1.695e-01 0.4116669
##  Participant.5  Cue_Con         1.529e-02 0.1236598
##  Participant.6  Cue_Ali         5.308e-02 0.2303939
##  Participant.7  Cue_Sam         9.290e-01 0.9638497
##  Participant.8  Con_Ali         0.000e+00 0.0000000
##  Participant.9  Con_Sam         3.227e-01 0.5680713
##  Participant.10 Ali_Sam         1.166e-10 0.0000108
##  Participant.11 Cue_Con_Ali     0.000e+00 0.0000000
##  Participant.12 Cue_Con_Sam     1.410e+00 1.1875858
##  Participant.13 Cue_Ali_Sam     2.330e-02 0.1526353
##  Participant.14 Con_Ali_Sam     1.291e-01 0.3593150
##  Participant.15 Cue_Con_Ali_Sam 7.504e-02 0.2739304
## Number of obs: 20477, groups:  Participant, 32
## 
## Fixed effects:
##                                                                            Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                 1.37684    0.10414  13.221  < 2e-16 ***
## Cuebottom                                                                  -0.27090    0.13817  -1.961  0.04993 *  
## Congruencyincongruent                                                      -1.12419    0.09948 -11.300  < 2e-16 ***
## Alignmentmisaligned                                                        -0.13601    0.08431  -1.613  0.10672    
## SameDifferentdifferent                                                     -2.33178    0.15088 -15.454  < 2e-16 ***
## Cuebottom:Congruencyincongruent                                             0.33173    0.13835   2.398  0.01650 *  
## Cuebottom:Alignmentmisaligned                                              -0.07531    0.10289  -0.732  0.46421    
## Congruencyincongruent:Alignmentmisaligned                                   0.68120    0.09558   7.127 1.02e-12 ***
## Cuebottom:SameDifferentdifferent                                            0.69963    0.22026   3.176  0.00149 ** 
## Congruencyincongruent:SameDifferentdifferent                                1.71693    0.17217   9.972  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                  0.44037    0.09795   4.496 6.93e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                        -0.35334    0.12287  -2.876  0.00403 ** 
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                     -0.60078    0.24143  -2.488  0.01283 *  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                       -0.13801    0.12738  -1.083  0.27860    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent           -1.00373    0.13725  -7.313 2.60e-13 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent  0.72732    0.16944   4.292 1.77e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular

2.1.1.3 The reduced model

summary(rePCA(glmm_E1_resp_zcp))
## $Participant
## Importance of components:
##                         [,1]   [,2]    [,3]    [,4]    [,5]    [,6]   [,7]    [,8]    [,9]   [,10]   [,11]   [,12]   [,13]    [,14] [,15] [,16]
## Standard deviation     1.188 0.9638 0.56807 0.41167 0.35932 0.34381 0.2739 0.26039 0.23039 0.21990 0.15264 0.12366 0.06240 1.08e-05     0     0
## Proportion of Variance 0.419 0.2760 0.09588 0.05035 0.03836 0.03512 0.0223 0.02015 0.01577 0.01437 0.00692 0.00454 0.00116 0.00e+00     0     0
## Cumulative Proportion  0.419 0.6951 0.79096 0.84132 0.87968 0.91480 0.9371 0.95724 0.97301 0.98738 0.99430 0.99884 1.00000 1.00e+00     1     1

Con_Ali, Cue_Con_Ali, Ali_Sam, and Con_C were removed from extended model (glmm_E1_resp_zcp) due to that the variances they explained were smaller than 0.1%, making glmm_resp_rdc.

file_E1_resp_rdc <- file.path(folder_lmm, "E1_Resp_lmm_rdc.RData")

# fit the rdc model
if (!file.exists(file_E1_resp_rdc)) {
  glmm_E1_resp_rdc <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent + 
      (Cue_C + Ali_C + Sam_C + # Con_C + 
         Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam + 
         Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam + # Cue_Con_Ali + 
         Cue_Con_Ali_Sam || Participant),
    family = binomial(link = "probit"),
    data = df_lmm_E1,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  
  # save(glmm_E1_resp_rdc, file = file_E1_resp_rdc)
} else {
  load(file_E1_resp_rdc)
}

print(summary(glmm_E1_resp_rdc), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + (Cue_C +      Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam +      Cue_Ali_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam || Participant)
##    Data: df_lmm_E1
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##    21930    22152   -10937    21874    20449 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -6.5380 -0.6704  0.2629  0.6465  4.5875 
## 
## Random effects:
##  Groups         Name            Variance Std.Dev.
##  Participant    (Intercept)     0.06765  0.2601  
##  Participant.1  Cue_C           0.11821  0.3438  
##  Participant.2  Ali_C           0.04840  0.2200  
##  Participant.3  Sam_C           0.16847  0.4104  
##  Participant.4  Cue_Con         0.01592  0.1262  
##  Participant.5  Cue_Ali         0.05315  0.2305  
##  Participant.6  Cue_Sam         0.92706  0.9628  
##  Participant.7  Con_Sam         0.32072  0.5663  
##  Participant.8  Cue_Con_Sam     1.41750  1.1906  
##  Participant.9  Cue_Ali_Sam     0.02354  0.1534  
##  Participant.10 Con_Ali_Sam     0.13059  0.3614  
##  Participant.11 Cue_Con_Ali_Sam 0.07928  0.2816  
## Number of obs: 20477, groups:  Participant, 32
## 
## Fixed effects:
##                                                                            Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                 1.37285    0.10391  13.212  < 2e-16 ***
## Cuebottom                                                                  -0.26880    0.13829  -1.944  0.05193 .  
## Congruencyincongruent                                                      -1.12002    0.09891 -11.324  < 2e-16 ***
## Alignmentmisaligned                                                        -0.13554    0.08433  -1.607  0.10800    
## SameDifferentdifferent                                                     -2.32926    0.15105 -15.420  < 2e-16 ***
## Cuebottom:Congruencyincongruent                                             0.32913    0.13879   2.372  0.01771 *  
## Cuebottom:Alignmentmisaligned                                              -0.07570    0.10295  -0.735  0.46213    
## Congruencyincongruent:Alignmentmisaligned                                   0.68092    0.09577   7.110 1.16e-12 ***
## Cuebottom:SameDifferentdifferent                                            0.69963    0.22074   3.169  0.00153 ** 
## Congruencyincongruent:SameDifferentdifferent                                1.71425    0.17253   9.936  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                  0.44093    0.09818   4.491 7.10e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                        -0.35335    0.12315  -2.869  0.00411 ** 
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                     -0.60079    0.24243  -2.478  0.01320 *  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                       -0.13815    0.12770  -1.082  0.27932    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent           -1.00409    0.13778  -7.288 3.15e-13 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent  0.72745    0.17016   4.275 1.91e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

2.1.1.4 The extended model

file_E1_resp_etd <- file.path(folder_lmm, "E1_Resp_lmm_etd.RData")

# fit the etd model
if (!file.exists(file_E1_resp_etd)) {
  glmm_E1_resp_etd <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent + 
      (Cue_C + Ali_C + Sam_C + # Con_C + 
         Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam + 
         Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam + # Cue_Con_Ali + 
         Cue_Con_Ali_Sam | Participant),
    family = binomial(link = "probit"),
    data = df_lmm_E1,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  
  # save(glmm_E1_resp_etd, file = file_E1_resp_etd)
} else {
  load(file_E1_resp_etd)
}

print(summary(glmm_E1_resp_etd), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + (Cue_C +      Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam +      Cue_Ali_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam | Participant)
##    Data: df_lmm_E1
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  21953.0  22698.1 -10882.5  21765.0    20383 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -7.2143 -0.6713  0.2414  0.6543  5.2009 
## 
## Random effects:
##  Groups      Name            Variance Std.Dev. Corr                                                             
##  Participant (Intercept)     0.06913  0.2629                                                                    
##              Cue_C           0.11737  0.3426   -0.04                                                            
##              Ali_C           0.04882  0.2210    0.00  0.11                                                      
##              Sam_C           0.17347  0.4165   -0.03 -0.23 -0.31                                                
##              Cue_Con         0.03555  0.1885    0.03  0.19 -0.04  0.18                                          
##              Cue_Ali         0.05718  0.2391   -0.24 -0.09 -0.06  0.10  0.11                                    
##              Cue_Sam         0.92879  0.9637    0.45  0.17  0.30 -0.31 -0.67 -0.38                              
##              Con_Sam         0.33820  0.5815   -0.15  0.02  0.03 -0.36  0.21  0.43 -0.23                        
##              Cue_Con_Sam     1.51583  1.2312    0.15  0.00  0.37 -0.06 -0.68 -0.39  0.68  0.02                  
##              Cue_Ali_Sam     0.11897  0.3449    0.12  0.02 -0.11 -0.42 -0.75 -0.60  0.65 -0.09  0.67            
##              Con_Ali_Sam     0.14149  0.3762    0.30 -0.11 -0.50  0.23 -0.65 -0.37  0.40 -0.49  0.41  0.66      
##              Cue_Con_Ali_Sam 0.41604  0.6450    0.28  0.10  0.08 -0.42  0.27 -0.03  0.27  0.02 -0.41 -0.13 -0.41
## Number of obs: 20477, groups:  Participant, 32
## 
## Fixed effects:
##                                                                            Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                 1.37921    0.10376  13.292  < 2e-16 ***
## Cuebottom                                                                  -0.27976    0.11136  -2.512 0.011997 *  
## Congruencyincongruent                                                      -1.12484    0.12260  -9.175  < 2e-16 ***
## Alignmentmisaligned                                                        -0.14692    0.09122  -1.611 0.107261    
## SameDifferentdifferent                                                     -2.34239    0.15515 -15.097  < 2e-16 ***
## Cuebottom:Congruencyincongruent                                             0.34124    0.17196   1.984 0.047214 *  
## Cuebottom:Alignmentmisaligned                                              -0.06366    0.11998  -0.531 0.595732    
## Congruencyincongruent:Alignmentmisaligned                                   0.71541    0.10524   6.798 1.06e-11 ***
## Cuebottom:SameDifferentdifferent                                            0.71000    0.17087   4.155 3.25e-05 ***
## Congruencyincongruent:SameDifferentdifferent                                1.72964    0.20291   8.524  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                  0.45760    0.11811   3.874 0.000107 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                        -0.38787    0.13556  -2.861 0.004221 ** 
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                     -0.61307    0.27336  -2.243 0.024914 *  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                       -0.14414    0.15375  -0.937 0.348512    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent           -1.04984    0.15962  -6.577 4.80e-11 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent  0.75802    0.20051   3.781 0.000156 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1 
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E1_resp_etd))
## $Participant
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]    [,6]    [,7]    [,8]      [,9]     [,10]     [,11] [,12]
## Standard deviation     1.4977 0.8779 0.6733 0.39416 0.35799 0.31452 0.25116 0.21968 0.0003291 4.271e-06 1.554e-07     0
## Proportion of Variance 0.5663 0.1946 0.1145 0.03923 0.03236 0.02498 0.01593 0.01218 0.0000000 0.000e+00 0.000e+00     0
## Cumulative Proportion  0.5663 0.7609 0.8753 0.91456 0.94691 0.97189 0.98782 1.00000 1.0000000 1.000e+00 1.000e+00     1

Cue_Con, Ali_C, Cue_Ali, and Intercept were removed from the extended model.

file_E1_resp_etd1 <- file.path(folder_lmm, "E1_Resp_lmm_etd1.RData")

# fit the etd1 model
if (!file.exists(file_E1_resp_etd1)) {
  glmm_E1_resp_etd1 <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent + 
      (0 + Cue_C + Sam_C + # Con_C + Ali_C + 
         Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam + Cue_Con + Cue_Ali + 
         Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam + # Cue_Con_Ali + 
         Cue_Con_Ali_Sam | Participant),
    family = binomial(link = "probit"),
    data = df_lmm_E1,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  
  # save(glmm_E1_resp_etd1, file = file_E1_resp_etd1)
} else {
  load(file_E1_resp_etd1)
}

print(summary(glmm_E1_resp_etd1), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + (0 + Cue_C +      Sam_C + Cue_Sam + Con_Sam + Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam +      Cue_Con_Ali_Sam | Participant)
##    Data: df_lmm_E1
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  22521.5  22933.7 -11208.8  22417.5    20425 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.8285 -0.6903  0.2899  0.6800  4.5189 
## 
## Random effects:
##  Groups      Name            Variance Std.Dev. Corr                                     
##  Participant Cue_C           0.10766  0.3281                                            
##              Sam_C           0.16290  0.4036   -0.33                                    
##              Cue_Sam         0.81035  0.9002    0.26 -0.27                              
##              Con_Sam         0.31546  0.5617    0.02 -0.40 -0.24                        
##              Cue_Con_Sam     1.33283  1.1545    0.00 -0.01  0.65  0.06                  
##              Cue_Ali_Sam     0.06888  0.2625    0.02 -0.42  0.67 -0.05  0.74            
##              Con_Ali_Sam     0.16811  0.4100   -0.12  0.28  0.42 -0.50  0.42  0.63      
##              Cue_Con_Ali_Sam 0.36562  0.6047    0.20 -0.45  0.27 -0.01 -0.47 -0.26 -0.40
## Number of obs: 20477, groups:  Participant, 32
## 
## Fixed effects:
##                                                                            Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                 1.30526    0.08039  16.236  < 2e-16 ***
## Cuebottom                                                                  -0.21219    0.10068  -2.108   0.0351 *  
## Congruencyincongruent                                                      -1.07631    0.10762 -10.001  < 2e-16 ***
## Alignmentmisaligned                                                        -0.14998    0.07570  -1.981   0.0476 *  
## SameDifferentdifferent                                                     -2.24075    0.15104 -14.836  < 2e-16 ***
## Cuebottom:Congruencyincongruent                                             0.28714    0.14475   1.984   0.0473 *  
## Cuebottom:Alignmentmisaligned                                              -0.07573    0.09926  -0.763   0.4455    
## Congruencyincongruent:Alignmentmisaligned                                   0.67370    0.10185   6.615 3.72e-11 ***
## Cuebottom:SameDifferentdifferent                                            0.65403    0.16618   3.936 8.30e-05 ***
## Congruencyincongruent:SameDifferentdifferent                                1.66402    0.19578   8.500  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                  0.44771    0.11329   3.952 7.75e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                        -0.31669    0.12997  -2.437   0.0148 *  
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                     -0.56755    0.26167  -2.169   0.0301 *  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                       -0.13430    0.14522  -0.925   0.3551    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent           -1.00715    0.15898  -6.335 2.37e-10 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent  0.70048    0.19374   3.616   0.0003 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1 
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E1_resp_etd1))
## $Participant
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]    [,6]      [,7]      [,8]
## Standard deviation     1.3825 0.8423 0.6617 0.33736 0.31331 0.24743 3.564e-06 2.023e-07
## Proportion of Variance 0.5737 0.2129 0.1314 0.03416 0.02946 0.01838 0.000e+00 0.000e+00
## Cumulative Proportion  0.5737 0.7866 0.9180 0.95216 0.98162 1.00000 1.000e+00 1.000e+00

Cue_Ali_Sam, and Cue_C were removed from extended1 model.

file_E1_resp_etd2 <- file.path(folder_lmm, "E1_Resp_lmm_etd2.RData")

# fit the etd2 model
if (!file.exists(file_E1_resp_etd2)) {
  glmm_E1_resp_etd2 <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent + 
      (0 + Sam_C + # Con_C + Ali_C + Cue_C + 
         Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam + Cue_Con + Cue_Ali + 
         Cue_Con_Sam + Con_Ali_Sam + # Cue_Con_Ali + Cue_Ali_Sam + 
         Cue_Con_Ali_Sam | Participant),
    family = binomial(link = "probit"),
    data = df_lmm_E1,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E1_resp_etd2, file = file_E1_resp_etd2)
} else {
  load(file_E1_resp_etd2)
}

print(summary(glmm_E1_resp_etd2), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + (0 + Sam_C +      Cue_Sam + Con_Sam + Cue_Con_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam |      Participant)
##    Data: df_lmm_E1
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  22716.3  23009.6 -11321.1  22642.3    20440 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -6.7939 -0.7181  0.2875  0.6817  4.2680 
## 
## Random effects:
##  Groups      Name            Variance Std.Dev. Corr                         
##  Participant Sam_C           0.1618   0.4022                                
##              Cue_Sam         0.8394   0.9162   -0.30                        
##              Con_Sam         0.3131   0.5595   -0.41 -0.23                  
##              Cue_Con_Sam     1.2878   1.1348    0.02  0.62  0.06            
##              Con_Ali_Sam     0.1478   0.3845    0.33  0.41 -0.53  0.45      
##              Cue_Con_Ali_Sam 0.3708   0.6090   -0.54  0.36  0.01 -0.43 -0.40
## Number of obs: 20477, groups:  Participant, 32
## 
## Fixed effects:
##                                                                            Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                 1.31967    0.08665  15.231  < 2e-16 ***
## Cuebottom                                                                  -0.24504    0.09985  -2.454 0.014127 *  
## Congruencyincongruent                                                      -1.08920    0.10640 -10.237  < 2e-16 ***
## Alignmentmisaligned                                                        -0.16465    0.07168  -2.297 0.021627 *  
## SameDifferentdifferent                                                     -2.23527    0.15677 -14.258  < 2e-16 ***
## Cuebottom:Congruencyincongruent                                             0.31331    0.14175   2.210 0.027084 *  
## Cuebottom:Alignmentmisaligned                                              -0.05537    0.09373  -0.591 0.554748    
## Congruencyincongruent:Alignmentmisaligned                                   0.68730    0.10048   6.840 7.93e-12 ***
## Cuebottom:SameDifferentdifferent                                            0.67090    0.17333   3.871 0.000109 ***
## Congruencyincongruent:SameDifferentdifferent                                1.66461    0.19293   8.628  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                  0.46067    0.10223   4.506 6.60e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                        -0.33808    0.12902  -2.620 0.008786 ** 
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                     -0.58192    0.25547  -2.278 0.022737 *  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                       -0.15227    0.13083  -1.164 0.244449    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent           -1.01599    0.15525  -6.544 5.98e-11 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent  0.71534    0.19209   3.724 0.000196 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E1_resp_etd2))
## $Participant
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]     [,6]
## Standard deviation     1.3421 0.8715 0.6570 0.26879 0.23697 3.02e-07
## Proportion of Variance 0.5772 0.2434 0.1383 0.02315 0.01799 0.00e+00
## Cumulative Proportion  0.5772 0.8205 0.9588 0.98201 1.00000 1.00e+00

Con_Ali_Sam was removed from extended2 model.

file_E1_resp_etd3 <- file.path(folder_lmm, "E1_Resp_lmm_etd3.RData")

# fit the etd3 model
if (!file.exists(file_E1_resp_etd3)) {
  glmm_E1_resp_etd3 <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent + 
      (0 + Sam_C + # Con_C + Ali_C + Cue_C + 
         Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam + Cue_Con + Cue_Ali + 
         Cue_Con_Sam + # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam + 
         Cue_Con_Ali_Sam | Participant),
    family = binomial(link = "probit"),
    data = df_lmm_E1,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E1_resp_etd3, file = file_E1_resp_etd3)
} else {
  load(file_E1_resp_etd3)
}

print(summary(glmm_E1_resp_etd3), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + (0 + Sam_C +      Cue_Sam + Con_Sam + Cue_Con_Sam + Cue_Con_Ali_Sam | Participant)
##    Data: df_lmm_E1
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  22717.1  22962.8 -11327.5  22655.1    20446 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.9575 -0.7151  0.2997  0.6853  3.8068 
## 
## Random effects:
##  Groups      Name            Variance Std.Dev. Corr                   
##  Participant Sam_C           0.1599   0.3998                          
##              Cue_Sam         0.8401   0.9166   -0.30                  
##              Con_Sam         0.3070   0.5541   -0.41 -0.22            
##              Cue_Con_Sam     1.2733   1.1284    0.01  0.62  0.07      
##              Cue_Con_Ali_Sam 0.3498   0.5914   -0.55  0.39 -0.02 -0.43
## Number of obs: 20477, groups:  Participant, 32
## 
## Fixed effects:
##                                                                            Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                 1.31216    0.08357  15.701  < 2e-16 ***
## Cuebottom                                                                  -0.24399    0.09983  -2.444 0.014521 *  
## Congruencyincongruent                                                      -1.08313    0.09483 -11.422  < 2e-16 ***
## Alignmentmisaligned                                                        -0.15610    0.06780  -2.302 0.021308 *  
## SameDifferentdifferent                                                     -2.22155    0.15012 -14.799  < 2e-16 ***
## Cuebottom:Congruencyincongruent                                             0.31497    0.14097   2.234 0.025466 *  
## Cuebottom:Alignmentmisaligned                                              -0.05378    0.09324  -0.577 0.564069    
## Congruencyincongruent:Alignmentmisaligned                                   0.68213    0.08994   7.584 3.35e-14 ***
## Cuebottom:SameDifferentdifferent                                            0.66779    0.17350   3.849 0.000119 ***
## Congruencyincongruent:SameDifferentdifferent                                1.65395    0.16723   9.890  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                  0.44496    0.09150   4.863 1.15e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                        -0.34682    0.12811  -2.707 0.006786 ** 
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                     -0.58436    0.25391  -2.301 0.021366 *  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                       -0.15320    0.12967  -1.181 0.237425    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent           -1.00568    0.12728  -7.901 2.76e-15 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent  0.72743    0.18994   3.830 0.000128 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E1_resp_etd3))
## $Participant
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4] [,5]
## Standard deviation     1.3208 0.8690 0.6068 0.24931    0
## Proportion of Variance 0.5954 0.2577 0.1257 0.02121    0
## Cumulative Proportion  0.5954 0.8531 0.9788 1.00000    1

Sam_C was removed from extended3 model.

file_E1_resp_etd4 <- file.path(folder_lmm, "E1_Resp_lmm_etd4.RData")

# fit the etd4 model
if (!file.exists(file_E1_resp_etd4)) {
  glmm_E1_resp_etd4 <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent + 
      (0 + # Con_C + Ali_C + Cue_C + Sam_C + 
         Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam + Cue_Con + Cue_Ali + 
         Cue_Con_Sam + # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam + 
         Cue_Con_Ali_Sam | Participant),
    family = binomial(link = "probit"),
    data = df_lmm_E1,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E1_resp_etd4, file = file_E1_resp_etd4)
} else {
  load(file_E1_resp_etd4)
}

print(summary(glmm_E1_resp_etd4), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + (0 + Cue_Sam +      Con_Sam + Cue_Con_Sam + Cue_Con_Ali_Sam | Participant)
##    Data: df_lmm_E1
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  23054.2  23260.3 -11501.1  23002.2    20451 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.7093 -0.7045  0.3406  0.6959  2.6843 
## 
## Random effects:
##  Groups      Name            Variance Std.Dev. Corr             
##  Participant Cue_Sam         0.7870   0.8871                    
##              Con_Sam         0.2681   0.5178   -0.27            
##              Cue_Con_Sam     1.2556   1.1205    0.66  0.08      
##              Cue_Con_Ali_Sam 0.3112   0.5579    0.35 -0.05 -0.42
## Number of obs: 20477, groups:  Participant, 32
## 
## Fixed effects:
##                                                                            Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                 1.25684    0.05822  21.589  < 2e-16 ***
## Cuebottom                                                                  -0.20869    0.09448  -2.209 0.027191 *  
## Congruencyincongruent                                                      -1.03225    0.09143 -11.290  < 2e-16 ***
## Alignmentmisaligned                                                        -0.14259    0.06604  -2.159 0.030847 *  
## SameDifferentdifferent                                                     -2.12265    0.09192 -23.092  < 2e-16 ***
## Cuebottom:Congruencyincongruent                                             0.28160    0.13858   2.032 0.042146 *  
## Cuebottom:Alignmentmisaligned                                              -0.06807    0.09092  -0.749 0.454019    
## Congruencyincongruent:Alignmentmisaligned                                   0.65469    0.08791   7.447 9.53e-14 ***
## Cuebottom:SameDifferentdifferent                                            0.59888    0.16245   3.687 0.000227 ***
## Congruencyincongruent:SameDifferentdifferent                                1.56822    0.16045   9.774  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                  0.41327    0.08877   4.656 3.23e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                        -0.31889    0.12506  -2.550 0.010777 *  
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                     -0.52439    0.24958  -2.101 0.035634 *  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                       -0.12332    0.12589  -0.980 0.327267    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent           -0.95849    0.12374  -7.746 9.48e-15 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent  0.68209    0.18425   3.702 0.000214 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E1_resp_etd4))
## $Participant
## Importance of components:
##                          [,1]   [,2]   [,3]      [,4]
## Standard deviation     1.3142 0.7964 0.5105 1.346e-07
## Proportion of Variance 0.6587 0.2419 0.0994 0.000e+00
## Cumulative Proportion  0.6587 0.9006 1.0000 1.000e+00

Con_Sam was removed from extended4 model.

file_E1_resp_etd5 <- file.path(folder_lmm, "E1_Resp_lmm_etd5.RData")

# fit the etd5 model
if (!file.exists(file_E1_resp_etd5)) {
  glmm_E1_resp_etd5 <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent + 
      (0 + # Con_C + Ali_C + Cue_C + Sam_C + 
         Cue_Sam + # Con_Ali + Ali_Sam + Cue_Con + Cue_Ali + Con_Sam + 
         Cue_Con_Sam + # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam + 
         Cue_Con_Ali_Sam | Participant),
    family = binomial(link = "probit"),
    data = df_lmm_E1,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E1_resp_etd5, file = file_E1_resp_etd5)
} else {
  load(file_E1_resp_etd5)
}

print(summary(glmm_E1_resp_etd5), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + (0 + Cue_Sam +      Cue_Con_Sam + Cue_Con_Ali_Sam | Participant)
##    Data: df_lmm_E1
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  23165.7  23340.1 -11560.8  23121.7    20455 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.4835 -0.7183  0.3488  0.7120  2.9989 
## 
## Random effects:
##  Groups      Name            Variance Std.Dev. Corr       
##  Participant Cue_Sam         0.8046   0.897               
##              Cue_Con_Sam     1.3785   1.174     0.63      
##              Cue_Con_Ali_Sam 0.2820   0.531     0.42 -0.45
## Number of obs: 20477, groups:  Participant, 32
## 
## Fixed effects:
##                                                                            Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                 1.25396    0.05981  20.964  < 2e-16 ***
## Cuebottom                                                                  -0.22198    0.09690  -2.291 0.021974 *  
## Congruencyincongruent                                                      -1.02711    0.08340 -12.316  < 2e-16 ***
## Alignmentmisaligned                                                        -0.13955    0.06595  -2.116 0.034355 *  
## SameDifferentdifferent                                                     -2.11838    0.09607 -22.050  < 2e-16 ***
## Cuebottom:Congruencyincongruent                                             0.29631    0.14241   2.081 0.037468 *  
## Cuebottom:Alignmentmisaligned                                              -0.06778    0.09040  -0.750 0.453416    
## Congruencyincongruent:Alignmentmisaligned                                   0.64489    0.08754   7.367 1.75e-13 ***
## Cuebottom:SameDifferentdifferent                                            0.61898    0.16834   3.677 0.000236 ***
## Congruencyincongruent:SameDifferentdifferent                                1.55875    0.14196  10.980  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                  0.40915    0.08855   4.621 3.82e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                        -0.31001    0.12406  -2.499 0.012461 *  
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                     -0.54738    0.25822  -2.120 0.034021 *  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                       -0.12365    0.12482  -0.991 0.321859    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent           -0.94527    0.12291  -7.691 1.46e-14 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent  0.67025    0.18186   3.686 0.000228 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular

2.1.1.5 The optimal model

# compare the extended and reduced model
anova(glmm_E1_resp_etd5, glmm_E1_resp_rdc, refit = FALSE)
## Data: df_lmm_E1
## Models:
## glmm_E1_resp_etd5: Resp ~ Cue * Congruency * Alignment * SameDifferent + (0 + Cue_Sam + 
## glmm_E1_resp_etd5:     Cue_Con_Sam + Cue_Con_Ali_Sam | Participant)
## glmm_E1_resp_rdc: Resp ~ Cue * Congruency * Alignment * SameDifferent + (Cue_C + 
## glmm_E1_resp_rdc:     Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam + 
## glmm_E1_resp_rdc:     Cue_Ali_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam || Participant)
##                   npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)    
## glmm_E1_resp_etd5   22 23166 23340 -11561    23122                         
## glmm_E1_resp_rdc    28 21930 22152 -10937    21874 1247.6  6  < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

According to BIC, the reduced model (glmm_resp_rdc) explained the data better than the extended model (glmm_resp_etd5) and, therefore, the reduced model is used as the optimal model.

glmm_E1_resp_opt <- glmm_E1_resp_rdc

print(summary(glmm_E1_resp_opt), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + (Cue_C +      Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam +      Cue_Ali_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam || Participant)
##    Data: df_lmm_E1
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##    21930    22152   -10937    21874    20449 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -6.5380 -0.6704  0.2629  0.6465  4.5875 
## 
## Random effects:
##  Groups         Name            Variance Std.Dev.
##  Participant    (Intercept)     0.06765  0.2601  
##  Participant.1  Cue_C           0.11821  0.3438  
##  Participant.2  Ali_C           0.04840  0.2200  
##  Participant.3  Sam_C           0.16847  0.4104  
##  Participant.4  Cue_Con         0.01592  0.1262  
##  Participant.5  Cue_Ali         0.05315  0.2305  
##  Participant.6  Cue_Sam         0.92706  0.9628  
##  Participant.7  Con_Sam         0.32072  0.5663  
##  Participant.8  Cue_Con_Sam     1.41750  1.1906  
##  Participant.9  Cue_Ali_Sam     0.02354  0.1534  
##  Participant.10 Con_Ali_Sam     0.13059  0.3614  
##  Participant.11 Cue_Con_Ali_Sam 0.07928  0.2816  
## Number of obs: 20477, groups:  Participant, 32
## 
## Fixed effects:
##                                                                            Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                 1.37285    0.10391  13.212  < 2e-16 ***
## Cuebottom                                                                  -0.26880    0.13829  -1.944  0.05193 .  
## Congruencyincongruent                                                      -1.12002    0.09891 -11.324  < 2e-16 ***
## Alignmentmisaligned                                                        -0.13554    0.08433  -1.607  0.10800    
## SameDifferentdifferent                                                     -2.32926    0.15105 -15.420  < 2e-16 ***
## Cuebottom:Congruencyincongruent                                             0.32913    0.13879   2.372  0.01771 *  
## Cuebottom:Alignmentmisaligned                                              -0.07570    0.10295  -0.735  0.46213    
## Congruencyincongruent:Alignmentmisaligned                                   0.68092    0.09577   7.110 1.16e-12 ***
## Cuebottom:SameDifferentdifferent                                            0.69963    0.22074   3.169  0.00153 ** 
## Congruencyincongruent:SameDifferentdifferent                                1.71425    0.17253   9.936  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                  0.44093    0.09818   4.491 7.10e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                        -0.35335    0.12315  -2.869  0.00411 ** 
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                     -0.60079    0.24243  -2.478  0.01320 *  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                       -0.13815    0.12770  -1.082  0.27932    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent           -1.00409    0.13778  -7.288 3.15e-13 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent  0.72745    0.17016   4.275 1.91e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

2.1.2 Estimated marginal means

2.1.2.1 Estimated marginal means for hit and false alarm

(emm_E1_resp <- emmeans(glmm_E1_resp_opt, ~ Alignment + Congruency + Cue + SameDifferent))
##  Alignment  Congruency  Cue    SameDifferent  emmean     SE  df asymp.LCL asymp.UCL
##  aligned    congruent   top    same           1.3728 0.1039 Inf    1.1692    1.5765
##  misaligned congruent   top    same           1.2373 0.1023 Inf    1.0367    1.4379
##  aligned    incongruent top    same           0.2528 0.0976 Inf    0.0615    0.4441
##  misaligned incongruent top    same           0.7982 0.0996 Inf    0.6030    0.9934
##  aligned    congruent   bottom same           1.1040 0.1007 Inf    0.9066    1.3015
##  misaligned congruent   bottom same           0.8928 0.0992 Inf    0.6983    1.0873
##  aligned    incongruent bottom same           0.3132 0.0973 Inf    0.1224    0.5039
##  misaligned incongruent bottom same           0.4295 0.0975 Inf    0.2384    0.6206
##  aligned    congruent   top    different     -0.9564 0.1000 Inf   -1.1524   -0.7605
##  misaligned congruent   top    different     -0.6510 0.0983 Inf   -0.8436   -0.4585
##  aligned    incongruent top    different     -0.3622 0.0977 Inf   -0.5537   -0.1706
##  misaligned incongruent top    different     -0.3800 0.0975 Inf   -0.5710   -0.1889
##  aligned    congruent   bottom different     -0.5256 0.0980 Inf   -0.7177   -0.3334
##  misaligned congruent   bottom different     -0.4340 0.0976 Inf   -0.6254   -0.2427
##  aligned    incongruent bottom different     -0.2030 0.0973 Inf   -0.3937   -0.0123
##  misaligned incongruent bottom different     -0.0605 0.0972 Inf   -0.2511    0.1300
## 
## Results are given on the probit (not the response) scale. 
## Confidence level used: 0.95

2.1.2.2 Estimated marginal means for d’

emm_E1_d <- contrast(emm_E1_resp, method = "pairwise", simple = "SameDifferent")
summary(emm_E1_d[1:8], infer = c(TRUE, FALSE), adjust = "none")
##  contrast         Alignment  Congruency  Cue    estimate    SE  df asymp.LCL asymp.UCL
##  same - different aligned    congruent   top       2.329 0.151 Inf     2.033     2.625
##  same - different misaligned congruent   top       1.888 0.149 Inf     1.597     2.180
##  same - different aligned    incongruent top       0.615 0.145 Inf     0.331     0.899
##  same - different misaligned incongruent top       1.178 0.146 Inf     0.892     1.465
##  same - different aligned    congruent   bottom    1.630 0.147 Inf     1.341     1.919
##  same - different misaligned congruent   bottom    1.327 0.146 Inf     1.040     1.613
##  same - different aligned    incongruent bottom    0.516 0.145 Inf     0.233     0.800
##  same - different misaligned incongruent bottom    0.490 0.145 Inf     0.207     0.774
## 
## Note: contrasts are still on the probit scale 
## Confidence level used: 0.95
# quick check (uncorrected)
# emmip(emm_E1_d, Congruency ~ Alignment | Cue, CIs = TRUE) 
plot_E1_cf_d <- summary(emm_E1_d[1:8], infer = c(TRUE, FALSE), adjust = "sidak") %>% 
  as_tibble() %>% 
  ggplot(aes(y = estimate, x = Alignment, color = Congruency, group = Congruency)) +
  geom_point(position = position_dodge(width = 0.1), size = 2) +
  geom_line(aes(linetype = Congruency), position = position_dodge(width = 0.1),
            size = 0.8) +
  scale_linetype_manual(values=c("solid", "dashed"))+
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0, 
                alpha = .6, position = position_dodge(width = 0.1),
                show.legend = F) + 
  facet_grid(. ~Cue, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_d) +  # set the limit for y axis c(0, 1100)
  labs(x = "Target half", y = expression("Sensitivity"~italic("d'")), fill = "Congruency") +  # set the names for main, x and y axises
  geom_text(label = c("***", "", "", "", "*", "", "", ""), color = "red", size = 6, nudge_y = 0.5, nudge_x = 0.5) + # add starts to the significant columns
  theme_bw() +
  theme(
    text = element_text(size = 10),
    axis.title = element_text(size = 16), 
    axis.text = element_text(size = 14), # the size of the texts in plot
    # axis.text.x = element_text(angle = 45, vjust = 0.5),
    legend.title=element_text(size=15),
    legend.text=element_text(size=14),
    legend.position = "right",
    legend.key.width = unit(1.2, "cm"),
    plot.title = element_text(lineheight=.8, face="bold", size = 17),
    panel.border = element_blank(),
    panel.grid.minor = element_blank(),
    panel.grid.major = element_blank(),
    axis.line.x = element_line(colour = 'black', size=0.5, linetype='solid'),
    axis.line.y = element_line(colour = 'black', size=0.5, linetype='solid'),
    # remove the facet background color
    strip.text = element_text(face="bold", size=14, lineheight=5.0),
    strip.background = element_rect(fill="white", colour="white", size=1),
    strip.placement = "outside"
  ) 

# ggsave(filename = "E1_cf_d.pdf", plot_E1_cf_d, width = 8, height = 4.8)
plot_E1_cf_d

# ggsave(filename = "E1_cf_d.pdf", 
#        plot_E1_cf_d +
#          theme(legend.position=c(0.5, 0.15)), 
#        width = 7)

2.1.2.3 Composite effects

Composite face effects for top and bottom parts:

emm_E1_d_cf <- contrast(emm_E1_resp, interaction = "pairwise", by = "Cue")
summary(emm_E1_d_cf[1:2], infer = TRUE)
##  Alignment_pairwise   Congruency_pairwise     SameDifferent_pairwise Cue    estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  aligned - misaligned congruent - incongruent same - different       top       1.004 0.138 Inf     0.734     1.274   7.288  <.0001
##  aligned - misaligned congruent - incongruent same - different       bottom    0.277 0.130 Inf     0.022     0.531   2.129  0.0333
## 
## Confidence level used: 0.95
emm_E1_d_con <- contrast(emm_E1_resp, interaction = "pairwise", by = c("Cue", "Alignment"))
summary(emm_E1_d_con[c(1,3)], infer = TRUE)
##  Congruency_pairwise     SameDifferent_pairwise Cue    Alignment estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  congruent - incongruent same - different       top    aligned       1.71 0.173 Inf     1.376      2.05   9.936  <.0001
##  congruent - incongruent same - different       bottom aligned       1.11 0.169 Inf     0.782      1.44   6.583  <.0001
## 
## Confidence level used: 0.95

2.1.2.4 Facilitation and interference

# Sensitivity d'
emm_E1_d_fi <- contrast(emm_E1_resp, interaction = "pairwise", by = c("Cue", "Congruency"), adjust = "sidak")
summary(emm_E1_d_fi[1:4], infer=TRUE)
##  Alignment_pairwise   SameDifferent_pairwise Cue    Congruency  estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  aligned - misaligned same - different       top    congruent     0.4409 0.0982 Inf    0.1964     0.685   4.491  <.0001
##  aligned - misaligned same - different       top    incongruent  -0.5632 0.0862 Inf   -0.7778    -0.349  -6.536  <.0001
##  aligned - misaligned same - different       bottom congruent     0.3028 0.0897 Inf    0.0794     0.526   3.376  0.0029
##  aligned - misaligned same - different       bottom incongruent   0.0261 0.0830 Inf   -0.1807     0.233   0.315  0.9963
## 
## Confidence level used: 0.95 
## Conf-level adjustment: sidak method for 4 estimates 
## P value adjustment: sidak method for 4 tests
# # showing the differences between aligned and misaligned (aligned-misaligned)
# emmip(emm_E1_d_fi[1:4], ~ Cue | Congruency, CIs = TRUE, adjust = "sidak") +
#   geom_hline(yintercept = 0, linetype = "dashed")
plot_E1_cffi_d <- summary(emm_E1_d_fi[1:4], infer=TRUE, adjust = "sidak") %>% 
  as_tibble() %>% 
  ggplot(aes(y = estimate, x = Cue, color = Congruency)) +
  geom_point(size = 2) +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0, 
                alpha = .6) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  facet_grid(. ~ Congruency, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_fi_d) +  # set the limit for y axis c(0, 1100)
  labs(x = "Congruency", y = expression(italic("d'")~"(aligned-misaligned)")) +  # set the names for main, x and y axises
  theme_bw() +
  theme(
    text = element_text(size = 10),
    axis.title = element_text(size = 16), 
    axis.text = element_text(size = 14), # the size of the texts in plot
    # axis.text.x = element_text(angle = 45, vjust = 0.5),
    legend.title=element_text(size=15),
    legend.text=element_text(size=14),
    legend.position = "none",
    legend.key.width = unit(1.2, "cm"),
    plot.title = element_text(lineheight=.8, face="bold", size = 17),
    panel.border = element_blank(),
    panel.grid.minor = element_blank(),
    panel.grid.major = element_blank(),
    axis.line.x = element_line(colour = 'black', size=0.5, linetype='solid'),
    axis.line.y = element_line(colour = 'black', size=0.5, linetype='solid'),
    # remove the facet background color
    strip.text = element_text(face="bold", size=14, lineheight=5.0),
    strip.background = element_rect(fill="white", colour="white", size=1),
    strip.placement = "outside"
  ) +
  NULL

# ggsave(filename = "E1_fi_d.pdf", plot_E1_cffi_d, width = 7, height = 4.55)
plot_E1_cffi_d

plot_E1_cf_d_ <- plot_E1_cf_d +
  guides(color = guide_legend(nrow = 1, title.position = "left"), 
         linetype = guide_legend(nrow = 1, title.position = "left")) +
  theme(legend.position = c(0.6, 0.075),
        legend.box = "horizontal") 

plot_E1_d <- ggarrange(plot_E1_cf_d_, plot_E1_cffi_d, 
                       labels = c("A", "B"),
                       font.label = (list(size = 20)),
                       widths = c(1.5, 1),
                       nrow = 1)

# ggsave(filename = "E1_d.pdf", plot_E1_d, width = 10, height = 4.5)
plot_E1_d

2.1.2.5 Comparisons between facilitation and interference

contrast(emm_E1_d_fi, method = list("faci-inte"=c(1, 1)), by = "Cue")[1:2] %>% 
  summary(infer = TRUE)
##  contrast  Cue    estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  faci-inte top      -0.122 0.123 Inf    -0.363     0.119  -0.993  0.3206
##  faci-inte bottom    0.329 0.114 Inf     0.106     0.552   2.886  0.0039
## 
## Confidence level used: 0.95

2.2 Response times

df_lmm_E1_rt <- df_lmm_E1 %>% 
  filter(isCorrect == 1)

# save(df_lmm_E1_rt, file = file.path("data", "df_lmm_E1_rt.RData"))

2.2.1 Fitting the generalized mixed models

with log-transformation. #### The maximal model

# file_E1_rt_max <- file.path(folder_lmm, "E1_rt_lmm_max.RData")
# 
# # fit the max model
# if (!file.exists(file_E1_rt_max)) {
#   glmm_E1_rt_max <- glmer(
#     log(RT) ~ Cue * Congruency * Alignment + 
#       (Cue * Congruency * Alignment | Participant), 
#     family = lognormal(),
#     data = df_lmm_rt,
#     control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
#                            optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
#   )
# 
#   save(glmm_E1_rt_max, file = file_E1_rt_max)
# } else {
#   load(file_E1_rt_max)
# }
# 
# print(summary(glmm_E1_rt_max), corr = FALSE)

2.2.1.1 The zero-correlation-parameter model

file_E1_rt_zcp <- file.path(folder_lmm, "E1_rt_lmm_zcp.RData")

# fit the zcp1 model
if (!file.exists(file_E1_rt_zcp)) {
  glmm_E1_rt_zcp <- lmer(
    log(RT) ~ Cue * Congruency * Alignment +  
      (Cue_C + Con_C + Ali_C + 
         Cue_Con + Cue_Ali + Con_Ali + 
         Cue_Con_Ali || Participant),
    data = df_lmm_E1_rt,
    control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                          optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E1_rt_zcp, file = file_E1_rt_zcp)
} else {
  load(file_E1_rt_zcp)
}

print(summary(glmm_E1_rt_zcp), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Con_C + Ali_C +      Cue_Con + Cue_Ali + Con_Ali + Cue_Con_Ali || Participant)
##    Data: df_lmm_E1_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
## REML criterion at convergence: 13677.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6186 -0.5735 -0.1346  0.4295  7.6689 
## 
## Random effects:
##  Groups        Name        Variance  Std.Dev.
##  Participant   (Intercept) 0.0725762 0.26940 
##  Participant.1 Cue_C       0.0226908 0.15063 
##  Participant.2 Con_C       0.0010608 0.03257 
##  Participant.3 Ali_C       0.0011955 0.03458 
##  Participant.4 Cue_Con     0.0007338 0.02709 
##  Participant.5 Cue_Ali     0.0046874 0.06846 
##  Participant.6 Con_Ali     0.0000000 0.00000 
##  Participant.7 Cue_Con_Ali 0.0231449 0.15213 
##  Residual                  0.1478702 0.38454 
## Number of obs: 14339, groups:  Participant, 32
## 
## Fixed effects:
##                                                       Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                           6.689329   0.050535  38.630155 132.371  < 2e-16 ***
## Cuebottom                                             0.072469   0.030700  46.934968   2.361 0.022456 *  
## Congruencyincongruent                                 0.060203   0.015862 110.775801   3.796 0.000241 ***
## Alignmentmisaligned                                   0.035569   0.016166  89.228593   2.200 0.030371 *  
## Cuebottom:Congruencyincongruent                       0.001602   0.023408  52.241192   0.068 0.945697    
## Cuebottom:Alignmentmisaligned                         0.015209   0.025040  47.196342   0.607 0.546497    
## Congruencyincongruent:Alignmentmisaligned            -0.039663   0.022484  56.766074  -1.764 0.083102 .  
## Cuebottom:Congruencyincongruent:Alignmentmisaligned  -0.007022   0.037462  27.620253  -0.187 0.852689    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1 
## boundary (singular) fit: see ?isSingular

2.2.1.2 The reduced model

summary(rePCA(glmm_E1_rt_zcp))
## $Participant
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]    [,6]    [,7] [,8]
## Standard deviation     0.7006 0.3956 0.3917 0.17804 0.08992 0.08470 0.07045    0
## Proportion of Variance 0.5756 0.1836 0.1800 0.03718 0.00948 0.00841 0.00582    0
## Cumulative Proportion  0.5756 0.7591 0.9391 0.97629 0.98577 0.99418 1.00000    1

Con_Ali was removed from extended model (glmm_E1_rt_zcp) due to that the variance it explained was smaller than 0.1%, making glmm_E1_rt_rdc.

file_E1_rt_rdc <- file.path(folder_lmm, "E1_rt_lmm_rdc.RData")

# fit the rdc1 model
if (!file.exists(file_E1_rt_rdc)) {
  glmm_E1_rt_rdc <- lmer(
    log(RT) ~ Cue * Congruency * Alignment +  
      (Cue_C + Con_C + Ali_C + 
         Cue_Con + Cue_Ali + # Con_Ali + 
         Cue_Con_Ali || Participant),
    data = df_lmm_E1_rt,
    control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                          optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E1_rt_rdc, file = file_E1_rt_rdc)
} else {
  load(file_E1_rt_rdc)
}

print(summary(glmm_E1_rt_rdc), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Con_C + Ali_C +      Cue_Con + Cue_Ali + Cue_Con_Ali || Participant)
##    Data: df_lmm_E1_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
## REML criterion at convergence: 13677.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6186 -0.5735 -0.1346  0.4295  7.6689 
## 
## Random effects:
##  Groups        Name        Variance  Std.Dev.
##  Participant   (Intercept) 0.0725764 0.26940 
##  Participant.1 Cue_C       0.0226910 0.15064 
##  Participant.2 Con_C       0.0010608 0.03257 
##  Participant.3 Ali_C       0.0011956 0.03458 
##  Participant.4 Cue_Con     0.0007337 0.02709 
##  Participant.5 Cue_Ali     0.0046876 0.06847 
##  Participant.6 Cue_Con_Ali 0.0231478 0.15214 
##  Residual                  0.1478701 0.38454 
## Number of obs: 14339, groups:  Participant, 32
## 
## Fixed effects:
##                                                       Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                           6.689329   0.050535  38.630041 132.371  < 2e-16 ***
## Cuebottom                                             0.072469   0.030701  46.934893   2.361 0.022456 *  
## Congruencyincongruent                                 0.060203   0.015862 110.770723   3.796 0.000241 ***
## Alignmentmisaligned                                   0.035569   0.016166  89.225948   2.200 0.030373 *  
## Cuebottom:Congruencyincongruent                       0.001602   0.023409  52.237565   0.068 0.945701    
## Cuebottom:Alignmentmisaligned                         0.015209   0.025040  47.194938   0.607 0.546510    
## Congruencyincongruent:Alignmentmisaligned            -0.039663   0.022485  56.760997  -1.764 0.083108 .  
## Cuebottom:Congruencyincongruent:Alignmentmisaligned  -0.007021   0.037463  27.618818  -0.187 0.852700    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

2.2.1.3 The extended model

file_E1_rt_etd <- file.path(folder_lmm, "E1_rt_lmm_etd.RData")

# fit the etd1 model
if (!file.exists(file_E1_rt_etd)) {
  glmm_E1_rt_etd <- lmer(
    log(RT) ~ Cue * Congruency * Alignment +  
      (Cue_C + Con_C + Ali_C + 
         Cue_Con + Cue_Ali + # Con_Ali + 
         Cue_Con_Ali | Participant),
    data = df_lmm_E1_rt,
    control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                          optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E1_rt_etd, file = file_E1_rt_etd)
} else {
  load(file_E1_rt_etd)
}

print(summary(glmm_E1_rt_etd), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Con_C + Ali_C +      Cue_Con + Cue_Ali + Cue_Con_Ali | Participant)
##    Data: df_lmm_E1_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
## REML criterion at convergence: 13639.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.7341 -0.5741 -0.1341  0.4281  7.5985 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev. Corr                               
##  Participant (Intercept) 0.072195 0.26869                                     
##              Cue_C       0.022630 0.15043  -0.02                              
##              Con_C       0.001094 0.03308  -0.40  0.19                        
##              Ali_C       0.001456 0.03816  -0.30 -0.23  0.54                  
##              Cue_Con     0.002246 0.04739   0.18  0.30 -0.10 -0.89            
##              Cue_Ali     0.005632 0.07505  -0.05 -0.01 -0.16  0.67 -0.91      
##              Cue_Con_Ali 0.027429 0.16562  -0.46 -0.25 -0.27  0.52 -0.79  0.82
##  Residual                0.147687 0.38430                                     
## Number of obs: 14339, groups:  Participant, 32
## 
## Fixed effects:
##                                                       Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                          6.6890097  0.0539790 31.1138223 123.919  < 2e-16 ***
## Cuebottom                                            0.0724021  0.0269948 31.6152685   2.682  0.01153 *  
## Congruencyincongruent                                0.0604124  0.0173550 44.2973201   3.481  0.00113 ** 
## Alignmentmisaligned                                  0.0361463  0.0139979 47.8768479   2.582  0.01293 *  
## Cuebottom:Congruencyincongruent                      0.0008654  0.0286328 30.2534505   0.030  0.97609    
## Cuebottom:Alignmentmisaligned                        0.0154113  0.0192267 39.4831241   0.802  0.42761    
## Congruencyincongruent:Alignmentmisaligned           -0.0397233  0.0231668 56.6025894  -1.715  0.09188 .  
## Cuebottom:Congruencyincongruent:Alignmentmisaligned -0.0058548  0.0391678 29.1435306  -0.149  0.88220    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1 
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E1_rt_etd))
## $Participant
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]     [,6]      [,7]
## Standard deviation     0.7406 0.4537 0.3537 0.13699 0.01013 0.001418 7.519e-19
## Proportion of Variance 0.6106 0.2291 0.1393 0.02089 0.00011 0.000000 0.000e+00
## Cumulative Proportion  0.6106 0.8397 0.9790 0.99988 1.00000 1.000000 1.000e+00

Con_C, Ali_C, and Cue_Con were removed from extended model.

file_E1_rt_etd1 <- file.path(folder_lmm, "E1_rt_lmm_etd1.RData")

# fit the etd1 model
if (!file.exists(file_E1_rt_etd1)) {
  glmm_E1_rt_etd1 <- lmer(
    log(RT) ~ Cue * Congruency * Alignment +  
      (Cue_C + # Con_C + Ali_C + 
         Cue_Ali + # Con_Ali + Cue_Con + 
         Cue_Con_Ali | Participant),
    data = df_lmm_E1_rt,
    control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                          optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E1_rt_etd1, file = file_E1_rt_etd1)
} else {
  load(file_E1_rt_etd1)
}

print(summary(glmm_E1_rt_etd1), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Cue_Ali + Cue_Con_Ali |      Participant)
##    Data: df_lmm_E1_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
## REML criterion at convergence: 13678.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.7618 -0.5749 -0.1328  0.4291  7.6980 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev. Corr             
##  Participant (Intercept) 0.072713 0.26965                   
##              Cue_C       0.022643 0.15048  -0.02            
##              Cue_Ali     0.004764 0.06902  -0.01  0.00      
##              Cue_Con_Ali 0.026729 0.16349  -0.43 -0.26  0.84
##  Residual                0.148441 0.38528                   
## Number of obs: 14339, groups:  Participant, 32
## 
## Fixed effects:
##                                                       Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                           6.689159   0.051646  31.691272 129.520  < 2e-16 ***
## Cuebottom                                             0.071427   0.027748  33.934439   2.574  0.01459 *  
## Congruencyincongruent                                 0.060875   0.014804 146.126193   4.112 6.52e-05 ***
## Alignmentmisaligned                                   0.035516   0.012534  87.573213   2.834  0.00571 ** 
## Cuebottom:Congruencyincongruent                       0.002798   0.023482  58.492199   0.119  0.90557    
## Cuebottom:Alignmentmisaligned                         0.016498   0.018961  28.771290   0.870  0.39145    
## Congruencyincongruent:Alignmentmisaligned            -0.041767   0.023105  54.360420  -1.808  0.07618 .  
## Cuebottom:Congruencyincongruent:Alignmentmisaligned  -0.007626   0.038908  27.563343  -0.196  0.84604    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

2.2.1.4 The optimal model

# compare the extended and reduced model
anova(glmm_E1_rt_etd1, glmm_E1_rt_rdc, refit = FALSE)
## Data: df_lmm_E1_rt
## Models:
## glmm_E1_rt_rdc: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Con_C + Ali_C + 
## glmm_E1_rt_rdc:     Cue_Con + Cue_Ali + Cue_Con_Ali || Participant)
## glmm_E1_rt_etd1: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Cue_Ali + Cue_Con_Ali | 
## glmm_E1_rt_etd1:     Participant)
##                 npar   AIC   BIC  logLik deviance Chisq Df Pr(>Chisq)
## glmm_E1_rt_rdc    16 13709 13830 -6838.6    13677                    
## glmm_E1_rt_etd1   19 13717 13861 -6839.5    13679     0  3          1

According to BIC, the reduced model (glmm_E1_rt_rdc) explained the data better than the extended model (glmm_E1_rt_etd1) and, therefore, the reduced model is used as the optimal model.

glmm_E1_rt_opt <- glmm_E1_rt_rdc

print(summary(glmm_E1_rt_opt), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + (Cue_C + Con_C + Ali_C +      Cue_Con + Cue_Ali + Cue_Con_Ali || Participant)
##    Data: df_lmm_E1_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
## REML criterion at convergence: 13677.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6186 -0.5735 -0.1346  0.4295  7.6689 
## 
## Random effects:
##  Groups        Name        Variance  Std.Dev.
##  Participant   (Intercept) 0.0725764 0.26940 
##  Participant.1 Cue_C       0.0226910 0.15064 
##  Participant.2 Con_C       0.0010608 0.03257 
##  Participant.3 Ali_C       0.0011956 0.03458 
##  Participant.4 Cue_Con     0.0007337 0.02709 
##  Participant.5 Cue_Ali     0.0046876 0.06847 
##  Participant.6 Cue_Con_Ali 0.0231478 0.15214 
##  Residual                  0.1478701 0.38454 
## Number of obs: 14339, groups:  Participant, 32
## 
## Fixed effects:
##                                                       Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                           6.689329   0.050535  38.630041 132.371  < 2e-16 ***
## Cuebottom                                             0.072469   0.030701  46.934893   2.361 0.022456 *  
## Congruencyincongruent                                 0.060203   0.015862 110.770723   3.796 0.000241 ***
## Alignmentmisaligned                                   0.035569   0.016166  89.225948   2.200 0.030373 *  
## Cuebottom:Congruencyincongruent                       0.001602   0.023409  52.237565   0.068 0.945701    
## Cuebottom:Alignmentmisaligned                         0.015209   0.025040  47.194938   0.607 0.546510    
## Congruencyincongruent:Alignmentmisaligned            -0.039663   0.022485  56.760997  -1.764 0.083108 .  
## Cuebottom:Congruencyincongruent:Alignmentmisaligned  -0.007021   0.037463  27.618818  -0.187 0.852700    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

2.2.2 Estimated marginal means

2.2.2.1 Estimated marginal means for RT

file_E1_rt_emm <- file.path(folder_lmm, "E1_rt_emm.RData") 
if (!file.exists(file_E1_rt_emm)) {
  emm_E1_rt <- emmeans(glmm_E1_rt_opt, ~ Cue + Congruency + Alignment)
} else {
  load(file_E1_rt_emm)
}

# emmip(regrid(emm_E1_rt), Congruency ~ Alignment | Cue, CIs = TRUE)

summary(emm_E1_rt, type = "response") # equivalent to regrid(emm_rt)
##  Cue    Congruency  Alignment  response   SE  df asymp.LCL asymp.UCL
##  top    congruent   aligned         804 40.6 Inf       728       887
##  bottom congruent   aligned         864 43.7 Inf       783       954
##  top    incongruent aligned         854 43.4 Inf       773       943
##  bottom incongruent aligned         919 46.7 Inf       832      1016
##  top    congruent   misaligned      833 42.1 Inf       754       920
##  bottom congruent   misaligned      909 46.1 Inf       823      1004
##  top    incongruent misaligned      850 43.1 Inf       770       939
##  bottom incongruent misaligned      923 46.9 Inf       835      1020
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95 
## Intervals are back-transformed from the log scale
plot_E1_cf_rt <- summary(emm_E1_rt, type = "response") %>% 
  as_tibble() %>% 
  ggplot(aes(y = response, x = Alignment, color = Congruency, group = Congruency)) +
  geom_point(position = position_dodge(width = 0.1), size = 2) +
  geom_line(aes(linetype = Congruency), position = position_dodge(width = 0.1),
            size = 0.8) +
  scale_linetype_manual(values=c("solid", "dashed"))+
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0, 
                alpha = .6, position = position_dodge(width = 0.1),
                show.legend = F) + 
  facet_grid(. ~Cue, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_rt) +  # set the limit for y axis c(0, 1100)
  labs(x = "Target half", y = "Correct response times (ms)", fill = "Congruency") +  # set the names for main, x and y axises
  geom_text(label = c("", "", "++", "+", "", "", "", ""), color = "blue", size = 6, nudge_y = 50, nudge_x = 0.5) + # add starts to the significant columns
  theme_bw() +
  theme(
    text = element_text(size = 10),
    axis.title = element_text(size = 16), 
    axis.text = element_text(size = 14), # the size of the texts in plot
    # axis.text.x = element_text(angle = 45, vjust = 0.5),
    legend.title=element_text(size=15),
    legend.text=element_text(size=14),
    legend.position = "right",
    legend.key.width = unit(1.2, "cm"),
    plot.title = element_text(lineheight=.8, face="bold", size = 17),
    panel.border = element_blank(),
    panel.grid.minor = element_blank(),
    panel.grid.major = element_blank(),
    axis.line.x = element_line(colour = 'black', size=0.5, linetype='solid'),
    axis.line.y = element_line(colour = 'black', size=0.5, linetype='solid'),
    # remove the facet background color
    strip.text = element_text(face="bold", size=14, lineheight=5.0),
    strip.background = element_rect(fill="white", colour="white", size=1),
    strip.placement = "outside"
  ) 

# ggsave(filename = "E1_cf_rt.pdf", plot_E1_cf_rt, width = 8, height = 4.8)

plot_E1_cf_rt

2.2.2.2 Composite effects

Composite face effects for top and bottom parts:

emm_E1_rt_cf <- contrast(regrid(emm_E1_rt), interaction = "pairwise", by = "Cue", infer = TRUE)
emm_E1_rt_cf[1:2]
##  Congruency_pairwise     Alignment_pairwise   Cue    estimate   SE  df asymp.LCL asymp.UCL z.ratio p.value
##  congruent - incongruent aligned - misaligned top       -32.6 18.9 Inf     -69.6     4.424  -1.726  0.0844
##  congruent - incongruent aligned - misaligned bottom    -41.2 21.1 Inf     -82.6     0.119  -1.954  0.0507
## 
## Confidence level used: 0.95
emm_E1_rt_con <- contrast(regrid(emm_E1_rt), interaction = "pairwise", by = c("Cue", "Alignment"))
summary(emm_E1_rt_con[c(1,2)], infer = TRUE)
##  Congruency_pairwise     Cue    Alignment estimate   SE  df asymp.LCL asymp.UCL z.ratio p.value
##  congruent - incongruent top    aligned      -49.9 13.4 Inf     -76.2     -23.6  -3.715  0.0002
##  congruent - incongruent bottom aligned      -55.1 14.7 Inf     -83.9     -26.3  -3.748  0.0002
## 
## Confidence level used: 0.95

2.2.2.3 Facilitation and interference

emm_E1_rt_fi <- contrast(regrid(emm_E1_rt), "pairwise", by = c("Cue", "Congruency"), infer=TRUE, adjust = "sidak")

# emmip(emm_E1_rt_fi[1:4], ~ Cue | Congruency, CIs = TRUE, adjust = "sidak")
emm_E1_rt_fi[1:4]
##  contrast             Cue    Congruency  estimate   SE  df asymp.LCL asymp.UCL z.ratio p.value
##  aligned - misaligned top    congruent     -29.10 13.3 Inf     -62.3      4.06  -2.186  0.1103
##  aligned - misaligned bottom congruent     -45.02 14.9 Inf     -82.2     -7.85  -3.017  0.0102
##  aligned - misaligned top    incongruent     3.49 14.8 Inf     -33.4     40.38   0.236  0.9988
##  aligned - misaligned bottom incongruent    -3.77 16.5 Inf     -44.8     37.22  -0.229  0.9989
## 
## Confidence level used: 0.95 
## Conf-level adjustment: sidak method for 4 estimates 
## P value adjustment: sidak method for 4 tests
plot_E1_cffi_rt <- emm_E1_rt_fi[1:4] %>% 
  as_tibble() %>% 
  ggplot(aes(y = estimate, x = Cue, color = Congruency)) +
  geom_point(size = 2) +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0, 
                alpha = .6) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  facet_grid(. ~ Congruency, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_fi_rt) +  # set the limit for y axis c(0, 1100)
  labs(x = "Congruency", y = expression(RT~"(aligned-misaligned)")) +  # set the names for main, x and y axises
  theme_bw() +
  theme(
    text = element_text(size = 10),
    axis.title = element_text(size = 16), 
    axis.text = element_text(size = 14), # the size of the texts in plot
    # axis.text.x = element_text(angle = 45, vjust = 0.5),
    legend.title=element_text(size=15),
    legend.text=element_text(size=14),
    legend.position = "none",
    legend.key.width = unit(1.2, "cm"),
    plot.title = element_text(lineheight=.8, face="bold", size = 17),
    panel.border = element_blank(),
    panel.grid.minor = element_blank(),
    panel.grid.major = element_blank(),
    axis.line.x = element_line(colour = 'black', size=0.5, linetype='solid'),
    axis.line.y = element_line(colour = 'black', size=0.5, linetype='solid'),
    # remove the facet background color
    strip.text = element_text(face="bold", size=14, lineheight=5.0),
    strip.background = element_rect(fill="white", colour="white", size=1),
    strip.placement = "outside"
  ) +
  NULL

# ggsave(filename = "E1_fi_rt.pdf", plot_E1_cffi_rt, width = 7, height = 4.55)
plot_E1_cffi_rt

plot_E1_cf_rt_ <- plot_E1_cf_rt +
  guides(color = guide_legend(nrow = 1, title.position = "left"), 
         linetype = guide_legend(nrow = 1, title.position = "left")) +
  theme(legend.position = c(0.55, 0.075),
        legend.box = "horizontal") 

plot_E1_rt <- ggarrange(plot_E1_cf_rt_, plot_E1_cffi_rt, 
                       labels = c("A", "B"),
                       font.label = (list(size = 20)),
                       widths = c(1.5, 1),
                       nrow = 1)

# ggsave(filename = "E1_rt.pdf", plot_E1_rt, width = 10, height = 4.5)
plot_E1_rt

2.2.2.4 Comparisons between facilitation and interference

contrast(emm_E1_rt_fi, method = list("faci-inte"=c(1, 1)), by = "Cue")[1:2] %>% 
  summary(infer = TRUE)
##  contrast  Cue    estimate   SE  df asymp.LCL asymp.UCL z.ratio p.value
##  faci-inte top       -25.6 20.9 Inf     -66.6     15.33  -1.226  0.2201
##  faci-inte bottom    -48.8 23.3 Inf     -94.4     -3.19  -2.097  0.0360
## 
## Confidence level used: 0.95

3 Experiment 2

df_lmm_E2 <- df_lmm %>% 
  filter(Experiment != "109_cue") %>% 
  droplevels() 

contrasts(df_lmm_E2$Probability) <- MASS::contr.sdif(2)

df_lmm_E2 <- df_lmm_E2 %>% 
  mutate(Pro_C = if_else(Probability == 0.25, -0.5, 0.5),
         Cue_Pro = Cue_C * Pro_C,
         Con_Pro = Con_C * Pro_C,
         Ali_Pro = Ali_C * Pro_C,
         Sam_Pro = Sam_C * Pro_C,
         Cue_Con_Pro = Cue_Con * Pro_C,
         Cue_Ali_Pro = Cue_Ali * Pro_C,
         Cue_Sam_Pro = Cue_Sam * Pro_C,
         Con_Ali_Pro = Con_Ali * Pro_C,
         Con_Sam_Pro = Con_Sam * Pro_C,
         Ali_Sam_Pro = Ali_Sam * Pro_C,
         Cue_Con_Ali_Pro = Cue_Con_Ali * Pro_C,
         Cue_Con_Sam_Pro = Cue_Con_Sam * Pro_C,
         Cue_Ali_Sam_Pro = Cue_Ali_Sam * Pro_C,
         Con_Ali_Sam_Pro = Con_Ali_Sam * Pro_C,
         Cue_Con_Ali_Sam_Pro = Cue_Con_Ali_Sam * Pro_C
  )

# save(df_lmm_E2, file = file.path("data", "df_lmm_E2.RData"))

There were 32 participants in Experiment 2.

3.1 Response (d’)

3.1.1 Fitting the generalized mixed models

3.1.1.1 The maximal model

# file_E2_resp_max <- file.path(folder_lmm, "E2_Resp_lmm_max.RData")
# 
# # fit the max model
# if (!file.exists(file_E2_resp_max)) {
#   glmm_E2_resp_max <- glmer(
#     Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + 
#       (Cue * Congruency * Alignment * SameDifferent * Probability | Participant), # Con_Ali_Sam
#     family = binomial(link = "probit"),
#     data = df_lmm_E2,
#     control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
#                            optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
#   )
# 
#   save(glmm_E2_resp_max, file = file_E2_resp_max)
# } else {
#   load(file_E2_resp_max)
# }
# 
# print(summary(glmm_E2_resp_max), corr = FALSE)

3.1.1.2 The zero-correlation-parameter model

file_E2_resp_zcp <- file.path(folder_lmm, "E2_Resp_lmm_zcp.RData")

# fit the zcp model
if (!file.exists(file_E2_resp_zcp)) {
  glmm_E2_resp_zcp <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + 
      (Cue_C + Con_C + Ali_C + Sam_C + 
         Cue_Con + Cue_Ali + Cue_Sam + Con_Ali + Con_Sam + Ali_Sam + 
         Cue_Con_Ali + Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam + 
         Cue_Con_Ali_Sam +
         Pro_C + 
         Cue_Pro + Con_Pro + Ali_Pro + Sam_Pro +
         Cue_Con_Pro + Cue_Ali_Pro + Cue_Sam_Pro + Con_Ali_Pro + Con_Sam_Pro + Ali_Sam_Pro + 
         Cue_Con_Ali_Pro + Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro + Con_Ali_Sam_Pro + 
         Cue_Con_Ali_Sam_Pro || Participant),
    family = binomial(link = "probit"),
    data = df_lmm_E2,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  
  # save(glmm_E2_resp_zcp, file = file_E2_resp_zcp)
} else {
  load(file_E2_resp_zcp)
}

print(summary(glmm_E2_resp_zcp), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +      (Cue_C + Con_C + Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam +          Con_Ali + Con_Sam + Ali_Sam + Cue_Con_Ali + Cue_Con_Sam +          Cue_Ali_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam + Pro_C +          Cue_Pro + Con_Pro + Ali_Pro + Sam_Pro + Cue_Con_Pro +          Cue_Ali_Pro + Cue_Sam_Pro + Con_Ali_Pro + Con_Sam_Pro +          Ali_Sam_Pro + Cue_Con_Ali_Pro + Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro +          Con_Ali_Sam_Pro + Cue_Con_Ali_Sam_Pro || Participant)
##    Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  39518.4  40070.1 -19695.2  39390.4    40896 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -10.0859  -0.5478   0.1864   0.5144   6.1841 
## 
## Random effects:
##  Groups         Name                Variance  Std.Dev. 
##  Participant    (Intercept)         7.235e-02 2.690e-01
##  Participant.1  Cue_C               1.301e-01 3.606e-01
##  Participant.2  Con_C               5.310e-03 7.287e-02
##  Participant.3  Ali_C               3.194e-02 1.787e-01
##  Participant.4  Sam_C               2.027e-01 4.502e-01
##  Participant.5  Cue_Con             8.565e-04 2.927e-02
##  Participant.6  Cue_Ali             3.749e-02 1.936e-01
##  Participant.7  Cue_Sam             5.871e-01 7.662e-01
##  Participant.8  Con_Ali             0.000e+00 0.000e+00
##  Participant.9  Con_Sam             3.870e-01 6.221e-01
##  Participant.10 Ali_Sam             0.000e+00 0.000e+00
##  Participant.11 Cue_Con_Ali         0.000e+00 0.000e+00
##  Participant.12 Cue_Con_Sam         1.168e+00 1.081e+00
##  Participant.13 Cue_Ali_Sam         3.098e-09 5.566e-05
##  Participant.14 Con_Ali_Sam         1.058e-01 3.253e-01
##  Participant.15 Cue_Con_Ali_Sam     7.473e-02 2.734e-01
##  Participant.16 Pro_C               5.746e-02 2.397e-01
##  Participant.17 Cue_Pro             4.125e-01 6.422e-01
##  Participant.18 Con_Pro             1.446e-03 3.803e-02
##  Participant.19 Ali_Pro             2.664e-03 5.161e-02
##  Participant.20 Sam_Pro             4.237e-02 2.058e-01
##  Participant.21 Cue_Con_Pro         1.238e-10 1.113e-05
##  Participant.22 Cue_Ali_Pro         5.495e-02 2.344e-01
##  Participant.23 Cue_Sam_Pro         1.568e+00 1.252e+00
##  Participant.24 Con_Ali_Pro         4.282e-08 2.069e-04
##  Participant.25 Con_Sam_Pro         1.252e-01 3.538e-01
##  Participant.26 Ali_Sam_Pro         0.000e+00 0.000e+00
##  Participant.27 Cue_Con_Ali_Pro     1.121e-10 1.059e-05
##  Participant.28 Cue_Con_Sam_Pro     2.502e+00 1.582e+00
##  Participant.29 Cue_Ali_Sam_Pro     7.879e-02 2.807e-01
##  Participant.30 Con_Ali_Sam_Pro     0.000e+00 0.000e+00
##  Participant.31 Cue_Con_Ali_Sam_Pro 7.265e-02 2.695e-01
## Number of obs: 40960, groups:  Participant, 32
## 
## Fixed effects:
##                                                                                            Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                                1.167240   0.096271  12.125  < 2e-16 ***
## Cuebottom                                                                                  0.136779   0.120487   1.135 0.256284    
## Congruencyincongruent                                                                     -0.924275   0.090843 -10.174  < 2e-16 ***
## Alignmentmisaligned                                                                       -0.162074   0.064753  -2.503 0.012316 *  
## SameDifferentdifferent                                                                    -2.085094   0.139008 -15.000  < 2e-16 ***
## Probability2-1                                                                             0.504956   0.127782   3.952 7.76e-05 ***
## Cuebottom:Congruencyincongruent                                                            0.078762   0.120912   0.651 0.514790    
## Cuebottom:Alignmentmisaligned                                                             -0.004857   0.082901  -0.059 0.953278    
## Congruencyincongruent:Alignmentmisaligned                                                  0.528911   0.075136   7.039 1.93e-12 ***
## Cuebottom:SameDifferentdifferent                                                           0.141044   0.183222   0.770 0.441419    
## Congruencyincongruent:SameDifferentdifferent                                               1.488729   0.164982   9.024  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                                 0.310225   0.076795   4.040 5.35e-05 ***
## Cuebottom:Probability2-1                                                                  -0.809106   0.211692  -3.822 0.000132 ***
## Congruencyincongruent:Probability2-1                                                       0.111238   0.126787   0.877 0.380289    
## Alignmentmisaligned:Probability2-1                                                        -0.063634   0.107096  -0.594 0.552396    
## SameDifferentdifferent:Probability2-1                                                     -0.791074   0.177872  -4.447 8.69e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                                       -0.318486   0.100998  -3.153 0.001614 ** 
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                                    -0.221842   0.217551  -1.020 0.307860    
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                                      -0.122133   0.102062  -1.197 0.231440    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                          -0.813040   0.112991  -7.196 6.22e-13 ***
## Cuebottom:Congruencyincongruent:Probability2-1                                            -0.429262   0.203762  -2.107 0.035145 *  
## Cuebottom:Alignmentmisaligned:Probability2-1                                               0.040635   0.158902   0.256 0.798162    
## Congruencyincongruent:Alignmentmisaligned:Probability2-1                                   0.118865   0.138386   0.859 0.390376    
## Cuebottom:SameDifferentdifferent:Probability2-1                                            1.359361   0.309491   4.392 1.12e-05 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1                               -0.262296   0.208444  -1.258 0.208266    
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1                                  0.171116   0.144253   1.186 0.235533    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                 0.600009   0.141603   4.237 2.26e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1                        -0.146778   0.199783  -0.735 0.462528    
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1                      0.778487   0.347609   2.240 0.025120 *  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1                       -0.135719   0.209018  -0.649 0.516132    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1           -0.291421   0.192026  -1.518 0.129112    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1  0.441127   0.274619   1.606 0.108203    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1 
## boundary (singular) fit: see ?isSingular

3.1.1.3 The reduced model

summary(rePCA(glmm_E2_resp_zcp))
## $Participant
## Importance of components:
##                         [,1]   [,2]   [,3]    [,4]    [,5]    [,6]    [,7]    [,8]    [,9]  [,10]  [,11]   [,12]   [,13]   [,14]   [,15]   [,16]   [,17]   [,18]   [,19]   [,20]   [,21]   [,22]   [,23]     [,24]     [,25]     [,26]     [,27]    [,28]    [,29]    [,30]    [,31]    [,32]
## Standard deviation     1.582 1.2521 1.0807 0.76621 0.64223 0.62211 0.45022 0.36064 0.35380 0.3253 0.2807 0.27336 0.26953 0.26898 0.23971 0.23442 0.20585 0.19362 0.17872 0.07287 0.05161 0.03803 0.02927 0.0002069 5.566e-05 1.113e-05 1.059e-05 1.58e-16 1.58e-16 1.58e-16 1.58e-16 1.58e-16
## Proportion of Variance 0.324 0.2031 0.1513 0.07604 0.05342 0.05013 0.02625 0.01685 0.01621 0.0137 0.0102 0.00968 0.00941 0.00937 0.00744 0.00712 0.00549 0.00486 0.00414 0.00069 0.00035 0.00019 0.00011 0.0000000 0.000e+00 0.000e+00 0.000e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
## Cumulative Proportion  0.324 0.5271 0.6784 0.75440 0.80782 0.85795 0.88420 0.90105 0.91726 0.9310 0.9412 0.95085 0.96026 0.96963 0.97707 0.98419 0.98968 0.99453 0.99867 0.99936 0.99970 0.99989 1.00000 1.0000000 1.000e+00 1.000e+00 1.000e+00 1.00e+00 1.00e+00 1.00e+00 1.00e+00 1.00e+00

Con_Ali, Ali_Sam, Cue_Con_Ali, Ali_Sam_Pro, Con_Ali_Sam_Pro, Cue_Con_Pro, Cue_Con_Ali_Pro, Cue_Ali_Sam, Con_Ali_Pro, Cue_Con, Con_C, Con_Pro, and Ali_Pro were removed from extended model (glmm_E2_resp_zcp) due to that the variances they explained were smaller than 0.1%, making glmm_E2_resp_rdc.

file_E2_resp_rdc <- file.path(folder_lmm, "E2_Resp_lmm_rdc.RData")

# fit the rdc model
if (!file.exists(file_E2_resp_rdc)) {
  glmm_E2_resp_rdc <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + 
      (Cue_C + Ali_C + Sam_C + # Con_C + 
         Cue_Ali + Cue_Sam + Con_Sam +  # Con_Ali + Ali_Sam + Cue_Con + 
         Cue_Con_Sam + Con_Ali_Sam +  # Cue_Con_Ali + Cue_Ali_Sam + 
         Cue_Con_Ali_Sam +
         Pro_C + 
         Cue_Pro + Sam_Pro + # Con_Pro + Ali_Pro + 
         Cue_Ali_Pro + Cue_Sam_Pro + Con_Sam_Pro + # Ali_Sam_Pro + Cue_Con_Pro + Con_Ali_Pro + 
         Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro + # Con_Ali_Sam_Pro + Cue_Con_Ali_Pro + 
         Cue_Con_Ali_Sam_Pro || Participant),
    family = binomial(link = "probit"),
    data = df_lmm_E2,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E2_resp_rdc, file = file_E2_resp_rdc)
} else {
  load(file_E2_resp_rdc)
}

print(summary(glmm_E2_resp_rdc), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +      (Cue_C + Ali_C + Sam_C + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam +          Con_Ali_Sam + Cue_Con_Ali_Sam + Pro_C + Cue_Pro + Sam_Pro +          Cue_Ali_Pro + Cue_Sam_Pro + Con_Sam_Pro + Cue_Con_Sam_Pro +          Cue_Ali_Sam_Pro + Cue_Con_Ali_Sam_Pro || Participant)
##    Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  39499.3  39938.9 -19698.6  39397.3    40909 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -10.0280  -0.5442   0.1864   0.5132   6.4343 
## 
## Random effects:
##  Groups         Name                Variance Std.Dev.
##  Participant    (Intercept)         0.07191  0.2682  
##  Participant.1  Cue_C               0.12974  0.3602  
##  Participant.2  Ali_C               0.03200  0.1789  
##  Participant.3  Sam_C               0.20136  0.4487  
##  Participant.4  Cue_Ali             0.03777  0.1943  
##  Participant.5  Cue_Sam             0.58652  0.7658  
##  Participant.6  Con_Sam             0.38686  0.6220  
##  Participant.7  Cue_Con_Sam         1.16357  1.0787  
##  Participant.8  Con_Ali_Sam         0.10664  0.3266  
##  Participant.9  Cue_Con_Ali_Sam     0.07529  0.2744  
##  Participant.10 Pro_C               0.05742  0.2396  
##  Participant.11 Cue_Pro             0.41100  0.6411  
##  Participant.12 Sam_Pro             0.04238  0.2059  
##  Participant.13 Cue_Ali_Pro         0.05527  0.2351  
##  Participant.14 Cue_Sam_Pro         1.56194  1.2498  
##  Participant.15 Con_Sam_Pro         0.12776  0.3574  
##  Participant.16 Cue_Con_Sam_Pro     2.51204  1.5849  
##  Participant.17 Cue_Ali_Sam_Pro     0.07806  0.2794  
##  Participant.18 Cue_Con_Ali_Sam_Pro 0.08202  0.2864  
## Number of obs: 40960, groups:  Participant, 32
## 
## Fixed effects:
##                                                                                            Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                                1.161577   0.095404  12.175  < 2e-16 ***
## Cuebottom                                                                                  0.133927   0.119341   1.122  0.26177    
## Congruencyincongruent                                                                     -0.918154   0.089221 -10.291  < 2e-16 ***
## Alignmentmisaligned                                                                       -0.161014   0.064543  -2.495  0.01261 *  
## SameDifferentdifferent                                                                    -2.080834   0.138032 -15.075  < 2e-16 ***
## Probability2-1                                                                             0.500358   0.124609   4.015 5.93e-05 ***
## Cuebottom:Congruencyincongruent                                                            0.082352   0.119444   0.689  0.49053    
## Cuebottom:Alignmentmisaligned                                                             -0.003579   0.082497  -0.043  0.96540    
## Congruencyincongruent:Alignmentmisaligned                                                  0.528746   0.074825   7.066 1.59e-12 ***
## Cuebottom:SameDifferentdifferent                                                           0.144919   0.181197   0.800  0.42384    
## Congruencyincongruent:SameDifferentdifferent                                               1.484702   0.163887   9.059  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                                 0.309695   0.076405   4.053 5.05e-05 ***
## Cuebottom:Probability2-1                                                                  -0.799695   0.205177  -3.898 9.72e-05 ***
## Congruencyincongruent:Probability2-1                                                       0.115795   0.124101   0.933  0.35079    
## Alignmentmisaligned:Probability2-1                                                        -0.062760   0.104884  -0.598  0.54959    
## SameDifferentdifferent:Probability2-1                                                     -0.782907   0.172408  -4.541 5.60e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                                       -0.320274   0.100435  -3.189  0.00143 ** 
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                                    -0.227217   0.215256  -1.056  0.29117    
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                                      -0.123808   0.101420  -1.221  0.22218    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                          -0.813777   0.112578  -7.229 4.88e-13 ***
## Cuebottom:Congruencyincongruent:Probability2-1                                            -0.441175   0.198630  -2.221  0.02635 *  
## Cuebottom:Alignmentmisaligned:Probability2-1                                               0.039556   0.155778   0.254  0.79955    
## Congruencyincongruent:Alignmentmisaligned:Probability2-1                                   0.118771   0.136061   0.873  0.38270    
## Cuebottom:SameDifferentdifferent:Probability2-1                                            1.347036   0.298311   4.516 6.32e-06 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1                               -0.270481   0.204823  -1.321  0.18665    
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1                                  0.169703   0.141541   1.199  0.23054    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                 0.602570   0.140816   4.279 1.88e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1                        -0.146111   0.196348  -0.744  0.45679    
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1                      0.792652   0.339792   2.333  0.01966 *  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1                       -0.135063   0.204362  -0.661  0.50867    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1           -0.291600   0.188664  -1.546  0.12220    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1  0.441772   0.269640   1.638  0.10134    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1 
## Model failed to converge with max|grad| = 0.0036263 (tol = 0.001, component 1)
file_E2_resp_rdc1 <- file.path(folder_lmm, "E2_Resp_lmm_rdc1.RData")

# fit the rdc1 model
if (!file.exists(file_E2_resp_rdc1)) {
  ss <- getME(glmm_E2_resp_rdc, c("theta","fixef"))
  glmm_E2_resp_rdc1 <- update(
    glmm_E2_resp_rdc, start=ss,
    control=glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                         optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE)))
  # save(glmm_E2_resp_rdc1, file = file_E2_resp_rdc1)
} else {
  load(file_E2_resp_rdc1)
}

print(summary(glmm_E2_resp_rdc1), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +      (Cue_C + Ali_C + Sam_C + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam +          Con_Ali_Sam + Cue_Con_Ali_Sam + Pro_C + Cue_Pro + Sam_Pro +          Cue_Ali_Pro + Cue_Sam_Pro + Con_Sam_Pro + Cue_Con_Sam_Pro +          Cue_Ali_Sam_Pro + Cue_Con_Ali_Sam_Pro || Participant)
##    Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  39499.3  39938.9 -19698.6  39397.3    40909 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -10.0280  -0.5442   0.1864   0.5132   6.4344 
## 
## Random effects:
##  Groups         Name                Variance Std.Dev.
##  Participant    (Intercept)         0.07191  0.2682  
##  Participant.1  Cue_C               0.12974  0.3602  
##  Participant.2  Ali_C               0.03200  0.1789  
##  Participant.3  Sam_C               0.20136  0.4487  
##  Participant.4  Cue_Ali             0.03777  0.1943  
##  Participant.5  Cue_Sam             0.58652  0.7658  
##  Participant.6  Con_Sam             0.38689  0.6220  
##  Participant.7  Cue_Con_Sam         1.16352  1.0787  
##  Participant.8  Con_Ali_Sam         0.10663  0.3265  
##  Participant.9  Cue_Con_Ali_Sam     0.07532  0.2744  
##  Participant.10 Pro_C               0.05742  0.2396  
##  Participant.11 Cue_Pro             0.41100  0.6411  
##  Participant.12 Sam_Pro             0.04238  0.2059  
##  Participant.13 Cue_Ali_Pro         0.05528  0.2351  
##  Participant.14 Cue_Sam_Pro         1.56195  1.2498  
##  Participant.15 Con_Sam_Pro         0.12775  0.3574  
##  Participant.16 Cue_Con_Sam_Pro     2.51212  1.5850  
##  Participant.17 Cue_Ali_Sam_Pro     0.07809  0.2795  
##  Participant.18 Cue_Con_Ali_Sam_Pro 0.08224  0.2868  
## Number of obs: 40960, groups:  Participant, 32
## 
## Fixed effects:
##                                                                                            Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                                1.161644   0.095789  12.127  < 2e-16 ***
## Cuebottom                                                                                  0.133884   0.119940   1.116 0.264310    
## Congruencyincongruent                                                                     -0.918241   0.089631 -10.245  < 2e-16 ***
## Alignmentmisaligned                                                                       -0.161054   0.064846  -2.484 0.013005 *  
## SameDifferentdifferent                                                                    -2.080951   0.138735 -14.999  < 2e-16 ***
## Probability2-1                                                                             0.500269   0.126476   3.955 7.64e-05 ***
## Cuebottom:Congruencyincongruent                                                            0.082398   0.120225   0.685 0.493116    
## Cuebottom:Alignmentmisaligned                                                             -0.003555   0.082858  -0.043 0.965777    
## Congruencyincongruent:Alignmentmisaligned                                                  0.528811   0.075317   7.021 2.20e-12 ***
## Cuebottom:SameDifferentdifferent                                                           0.145001   0.182228   0.796 0.426201    
## Congruencyincongruent:SameDifferentdifferent                                               1.484846   0.164570   9.023  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                                 0.309744   0.076963   4.025 5.71e-05 ***
## Cuebottom:Probability2-1                                                                  -0.799515   0.208879  -3.828 0.000129 ***
## Congruencyincongruent:Probability2-1                                                       0.115955   0.125358   0.925 0.354972    
## Alignmentmisaligned:Probability2-1                                                        -0.062710   0.106376  -0.590 0.555521    
## SameDifferentdifferent:Probability2-1                                                     -0.782734   0.175982  -4.448 8.68e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                                       -0.320322   0.101029  -3.171 0.001521 ** 
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                                    -0.227313   0.216593  -1.049 0.293950    
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                                      -0.123835   0.102075  -1.213 0.225065    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                          -0.813867   0.113356  -7.180 6.98e-13 ***
## Cuebottom:Congruencyincongruent:Probability2-1                                            -0.441463   0.201487  -2.191 0.028450 *  
## Cuebottom:Alignmentmisaligned:Probability2-1                                               0.039470   0.158284   0.249 0.803082    
## Congruencyincongruent:Alignmentmisaligned:Probability2-1                                   0.118690   0.138420   0.857 0.391191    
## Cuebottom:SameDifferentdifferent:Probability2-1                                            1.346692   0.304851   4.418 9.98e-06 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1                               -0.270748   0.207217  -1.307 0.191353    
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1                                  0.169636   0.144319   1.175 0.239825    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                 0.602634   0.141749   4.251 2.12e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1                        -0.145973   0.200610  -0.728 0.466829    
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1                      0.793152   0.344651   2.301 0.021374 *  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1                       -0.134931   0.208670  -0.647 0.517875    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1           -0.291497   0.193049  -1.510 0.131053    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1  0.441598   0.276719   1.596 0.110525    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00152842 (tol = 0.001, component 1)

Ali_C was further removed.

file_E2_resp_rdc2 <- file.path(folder_lmm, "E2_Resp_lmm_rdc2.RData")

# fit the rdc2 model
if (!file.exists(file_E2_resp_rdc2)) {
  glmm_E2_resp_rdc2 <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + 
      (Cue_C + Sam_C + # Con_C + Ali_C + 
         Cue_Ali + Cue_Sam + Con_Sam +  # Con_Ali + Ali_Sam + Cue_Con + 
         Cue_Con_Sam + Con_Ali_Sam +  # Cue_Con_Ali + Cue_Ali_Sam + 
         Cue_Con_Ali_Sam +
         Pro_C + 
         Cue_Pro + Sam_Pro + # Con_Pro + Ali_Pro + 
         Cue_Ali_Pro + Cue_Sam_Pro + Con_Sam_Pro + # Ali_Sam_Pro + Cue_Con_Pro + Con_Ali_Pro + 
         Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro + # Con_Ali_Sam_Pro + Cue_Con_Ali_Pro + 
         Cue_Con_Ali_Sam_Pro || Participant),
    family = binomial(link = "probit"),
    data = df_lmm_E2,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E2_resp_rdc2, file = file_E2_resp_rdc2)
} else {
  load(file_E2_resp_rdc2)
}

print(summary(glmm_E2_resp_rdc2), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +      (Cue_C + Sam_C + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam +          Con_Ali_Sam + Cue_Con_Ali_Sam + Pro_C + Cue_Pro + Sam_Pro +          Cue_Ali_Pro + Cue_Sam_Pro + Con_Sam_Pro + Cue_Con_Sam_Pro +          Cue_Ali_Sam_Pro + Cue_Con_Ali_Sam_Pro || Participant)
##    Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  39575.2  40006.3 -19737.6  39475.2    40910 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -10.6455  -0.5528   0.1967   0.5113   5.7139 
## 
## Random effects:
##  Groups         Name                Variance Std.Dev.
##  Participant    (Intercept)         0.07145  0.2673  
##  Participant.1  Cue_C               0.12947  0.3598  
##  Participant.2  Sam_C               0.19931  0.4464  
##  Participant.3  Cue_Ali             0.04192  0.2047  
##  Participant.4  Cue_Sam             0.58683  0.7660  
##  Participant.5  Con_Sam             0.38364  0.6194  
##  Participant.6  Cue_Con_Sam         1.15766  1.0759  
##  Participant.7  Con_Ali_Sam         0.10035  0.3168  
##  Participant.8  Cue_Con_Ali_Sam     0.07774  0.2788  
##  Participant.9  Pro_C               0.05713  0.2390  
##  Participant.10 Cue_Pro             0.40833  0.6390  
##  Participant.11 Sam_Pro             0.04196  0.2048  
##  Participant.12 Cue_Ali_Pro         0.10085  0.3176  
##  Participant.13 Cue_Sam_Pro         1.54889  1.2445  
##  Participant.14 Con_Sam_Pro         0.12625  0.3553  
##  Participant.15 Cue_Con_Sam_Pro     2.48434  1.5762  
##  Participant.16 Cue_Ali_Sam_Pro     0.08956  0.2993  
##  Participant.17 Cue_Con_Ali_Sam_Pro 0.09184  0.3030  
## Number of obs: 40960, groups:  Participant, 32
## 
## Fixed effects:
##                                                                                            Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                                1.164756   0.093859  12.410  < 2e-16 ***
## Cuebottom                                                                                  0.133595   0.119396   1.119  0.26317    
## Congruencyincongruent                                                                     -0.919451   0.088659 -10.371  < 2e-16 ***
## Alignmentmisaligned                                                                       -0.175552   0.056182  -3.125  0.00178 ** 
## SameDifferentdifferent                                                                    -2.082488   0.137486 -15.147  < 2e-16 ***
## Probability2-1                                                                             0.504191   0.124335   4.055 5.01e-05 ***
## Cuebottom:Congruencyincongruent                                                            0.082452   0.119261   0.691  0.48934    
## Cuebottom:Alignmentmisaligned                                                             -0.002788   0.083158  -0.034  0.97325    
## Congruencyincongruent:Alignmentmisaligned                                                  0.535632   0.074313   7.208 5.69e-13 ***
## Cuebottom:SameDifferentdifferent                                                           0.144981   0.180905   0.801  0.42289    
## Congruencyincongruent:SameDifferentdifferent                                               1.484362   0.162668   9.125  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                                 0.327358   0.075751   4.322 1.55e-05 ***
## Cuebottom:Probability2-1                                                                  -0.800391   0.204913  -3.906 9.38e-05 ***
## Congruencyincongruent:Probability2-1                                                       0.113429   0.123145   0.921  0.35699    
## Alignmentmisaligned:Probability2-1                                                        -0.071931   0.106629  -0.675  0.49994    
## SameDifferentdifferent:Probability2-1                                                     -0.786107   0.171382  -4.587 4.50e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                                       -0.319841   0.100426  -3.185  0.00145 ** 
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                                    -0.226218   0.214466  -1.055  0.29152    
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                                      -0.126699   0.101285  -1.251  0.21097    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                          -0.820362   0.111485  -7.358 1.86e-13 ***
## Cuebottom:Congruencyincongruent:Probability2-1                                            -0.441981   0.197312  -2.240  0.02509 *  
## Cuebottom:Alignmentmisaligned:Probability2-1                                               0.041045   0.160452   0.256  0.79810    
## Congruencyincongruent:Alignmentmisaligned:Probability2-1                                   0.120043   0.136301   0.881  0.37847    
## Cuebottom:SameDifferentdifferent:Probability2-1                                            1.351061   0.297076   4.548 5.42e-06 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1                               -0.270287   0.202271  -1.336  0.18146    
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1                                  0.179901   0.141997   1.267  0.20518    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                 0.601164   0.140948   4.265 2.00e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1                        -0.134248   0.196907  -0.682  0.49538    
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1                      0.790854   0.336433   2.351  0.01874 *  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1                       -0.144169   0.205911  -0.700  0.48383    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1           -0.284773   0.188893  -1.508  0.13166    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1  0.426096   0.270915   1.573  0.11576    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

3.1.1.4 The extended model

file_E2_resp_etd <- file.path(folder_lmm, "E2_Resp_lmm_etd.RData")

# fit the etd model
if (!file.exists(file_E2_resp_etd)) {
  glmm_E2_resp_etd <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + 
      (Cue_C + Sam_C + # Con_C + Ali_C + 
         Cue_Ali + Cue_Sam + Con_Sam +  # Con_Ali + Ali_Sam + Cue_Con + 
         Cue_Con_Sam + Con_Ali_Sam +  # Cue_Con_Ali + Cue_Ali_Sam + 
         Cue_Con_Ali_Sam +
         Pro_C + 
         Cue_Pro + Sam_Pro + # Con_Pro + Ali_Pro + 
         Cue_Ali_Pro + Cue_Sam_Pro + Con_Sam_Pro + # Ali_Sam_Pro + Cue_Con_Pro + Con_Ali_Pro + 
         Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro + # Con_Ali_Sam_Pro + Cue_Con_Ali_Pro + 
         Cue_Con_Ali_Sam_Pro | Participant),
    family = binomial(link = "probit"),
    data = df_lmm_E2,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E2_resp_etd, file = file_E2_resp_etd)
} else {
  load(file_E2_resp_etd)
}

print(summary(glmm_E2_resp_etd), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +      (Cue_C + Sam_C + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam +          Con_Ali_Sam + Cue_Con_Ali_Sam + Pro_C + Cue_Pro + Sam_Pro +          Cue_Ali_Pro + Cue_Sam_Pro + Con_Sam_Pro + Cue_Con_Sam_Pro +          Cue_Ali_Sam_Pro + Cue_Con_Ali_Sam_Pro | Participant)
##    Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  39642.9  41392.8 -19618.4  39236.9    40757 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -11.1243  -0.5461   0.1847   0.5087   5.4164 
## 
## Random effects:
##  Groups      Name                Variance Std.Dev. Corr                                                                                                 
##  Participant (Intercept)         0.07234  0.2690                                                                                                        
##              Cue_C               0.13027  0.3609   -0.24                                                                                                
##              Sam_C               0.19650  0.4433   -0.28 -0.08                                                                                          
##              Cue_Ali             0.04713  0.2171   -0.45 -0.06  0.48                                                                                    
##              Cue_Sam             0.56720  0.7531    0.02 -0.05  0.11 -0.15                                                                              
##              Con_Sam             0.41210  0.6420   -0.02 -0.12 -0.12 -0.13  0.24                                                                        
##              Cue_Con_Sam         1.24842  1.1173   -0.07 -0.12  0.12 -0.11  0.93  0.34                                                                  
##              Con_Ali_Sam         0.12819  0.3580    0.03  0.24  0.36  0.22  0.40 -0.48  0.36                                                            
##              Cue_Con_Ali_Sam     0.14618  0.3823   -0.20 -0.05 -0.38  0.11 -0.43 -0.04 -0.35 -0.33                                                      
##              Pro_C               0.05618  0.2370    0.08 -0.06 -0.41 -0.25  0.01  0.56  0.15 -0.23 -0.06                                                
##              Cue_Pro             0.41443  0.6438    0.25 -0.35 -0.05  0.16  0.00 -0.01 -0.04  0.04 -0.29  0.17                                          
##              Sam_Pro             0.04925  0.2219   -0.10  0.66 -0.20  0.09 -0.17 -0.11 -0.19  0.11 -0.31  0.04  0.18                                    
##              Cue_Ali_Pro         0.10190  0.3192   -0.05  0.01 -0.04 -0.13  0.26  0.10  0.32  0.25 -0.16  0.08 -0.14 -0.04                              
##              Cue_Sam_Pro         1.50213  1.2256   -0.10  0.37 -0.40  0.17 -0.22 -0.19 -0.13 -0.04  0.48  0.00 -0.07  0.24 -0.11                        
##              Con_Sam_Pro         0.16649  0.4080   -0.37  0.28  0.11  0.42  0.20  0.01  0.29  0.41  0.36 -0.32 -0.45  0.01  0.30  0.34                  
##              Cue_Con_Sam_Pro     2.68063  1.6373   -0.23  0.25  0.10  0.17 -0.07  0.55 -0.01 -0.26  0.25  0.04 -0.25  0.01  0.04  0.28  0.44            
##              Cue_Ali_Sam_Pro     0.30480  0.5521   -0.10 -0.02  0.10 -0.14  0.20  0.12  0.10 -0.08  0.10  0.18 -0.08 -0.57 -0.18  0.10 -0.18  0.19      
##              Cue_Con_Ali_Sam_Pro 1.29026  1.1359    0.39 -0.14 -0.27 -0.16 -0.02 -0.68 -0.14  0.27 -0.12 -0.37  0.48  0.19  0.05  0.05 -0.27 -0.70 -0.34
## Number of obs: 40960, groups:  Participant, 32
## 
## Fixed effects:
##                                                                                           Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                                1.16378    0.09577  12.152  < 2e-16 ***
## Cuebottom                                                                                  0.13693    0.08922   1.535  0.12482    
## Congruencyincongruent                                                                     -0.92047    0.09260  -9.940  < 2e-16 ***
## Alignmentmisaligned                                                                       -0.17366    0.05836  -2.976  0.00292 ** 
## SameDifferentdifferent                                                                    -2.08752    0.12560 -16.620  < 2e-16 ***
## Probability2-1                                                                             0.50859    0.11888   4.278 1.89e-05 ***
## Cuebottom:Congruencyincongruent                                                            0.08571    0.12854   0.667  0.50489    
## Cuebottom:Alignmentmisaligned                                                             -0.02252    0.08692  -0.259  0.79560    
## Congruencyincongruent:Alignmentmisaligned                                                  0.53997    0.08036   6.720 1.82e-11 ***
## Cuebottom:SameDifferentdifferent                                                           0.14393    0.08868   1.623  0.10458    
## Congruencyincongruent:SameDifferentdifferent                                               1.49226    0.17075   8.739  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                                 0.33908    0.08183   4.144 3.42e-05 ***
## Cuebottom:Probability2-1                                                                  -0.81784    0.20095  -4.070 4.70e-05 ***
## Congruencyincongruent:Probability2-1                                                       0.10829    0.13738   0.788  0.43054    
## Alignmentmisaligned:Probability2-1                                                        -0.08277    0.12098  -0.684  0.49385    
## SameDifferentdifferent:Probability2-1                                                     -0.76710    0.17398  -4.409 1.04e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                                       -0.31111    0.10459  -2.975  0.00293 ** 
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                                    -0.23602    0.23437  -1.007  0.31393    
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                                      -0.11179    0.10543  -1.060  0.28900    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                          -0.84234    0.12582  -6.695 2.16e-11 ***
## Cuebottom:Congruencyincongruent:Probability2-1                                            -0.43512    0.24535  -1.773  0.07615 .  
## Cuebottom:Alignmentmisaligned:Probability2-1                                               0.05710    0.19223   0.297  0.76644    
## Congruencyincongruent:Alignmentmisaligned:Probability2-1                                   0.14020    0.15284   0.917  0.35897    
## Cuebottom:SameDifferentdifferent:Probability2-1                                            1.33822    0.31295   4.276 1.90e-05 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1                               -0.28488    0.23036  -1.237  0.21621    
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1                                  0.16430    0.17149   0.958  0.33804    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                 0.60574    0.15049   4.025 5.70e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1                        -0.15098    0.23349  -0.647  0.51788    
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1                      0.81564    0.43657   1.868  0.06172 .  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1                       -0.12617    0.27134  -0.465  0.64192    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1           -0.27745    0.22776  -1.218  0.22316    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1  0.40220    0.35575   1.131  0.25825    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1 
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E2_resp_etd))
## $Participant
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]    [,6]    [,7]    [,8]    [,9]   [,10]   [,11]  [,12]   [,13]   [,14]   [,15]    [,16]     [,17]     [,18]
## Standard deviation     1.9646 1.4686 1.1837 0.76286 0.68384 0.57853 0.48431 0.41992 0.30652 0.28379 0.24972 0.1799 0.14908 0.10023 0.01389 0.003311 0.0003458 7.185e-21
## Proportion of Variance 0.4057 0.2267 0.1473 0.06117 0.04915 0.03518 0.02465 0.01853 0.00987 0.00846 0.00655 0.0034 0.00234 0.00106 0.00002 0.000000 0.0000000 0.000e+00
## Cumulative Proportion  0.4057 0.6323 0.7796 0.84078 0.88993 0.92510 0.94976 0.96829 0.97816 0.98663 0.99318 0.9966 0.99892 0.99998 1.00000 1.000000 1.0000000 1.000e+00

Sam_Pro, Cue_Ali, Pro_C, Intercept, Cue_Ali_Pro, Con_Ali_Sam, Cue_C, Cue_Con_Ali_Sam, Con_Sam_Pro, and Sam_C were removed from extended model (glmm_E2_resp_etd) due to that the variances they explained were smaller than 1%, making glmm_E2_resp_etd1.

file_E2_resp_etd1 <- file.path(folder_lmm, "E2_Resp_lmm_etd1.RData")

# fit the etd1 model
if (!file.exists(file_E2_resp_etd1)) {
  glmm_E2_resp_etd1 <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + 
      (0 + # Con_C + Ali_C + Cue_C + Sam_C + 
         Cue_Sam + Con_Sam +  # Con_Ali + Ali_Sam + Cue_Con + Cue_Ali + 
         Cue_Con_Sam + # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam +  
         # Cue_Con_Ali_Sam +
         # Pro_C + 
         Cue_Pro + # Con_Pro + Ali_Pro + Sam_Pro + 
         Cue_Sam_Pro + # Ali_Sam_Pro + Cue_Con_Pro + Con_Ali_Pro + Cue_Ali_Pro + Con_Sam_Pro + 
         Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro + # Con_Ali_Sam_Pro + Cue_Con_Ali_Pro + 
         Cue_Con_Ali_Sam_Pro | Participant),
    family = binomial(link = "probit"),
    data = df_lmm_E2,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E2_resp_etd1, file = file_E2_resp_etd1)
} else {
  load(file_E2_resp_etd1)
}

print(summary(glmm_E2_resp_etd1), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +      (0 + Cue_Sam + Con_Sam + Cue_Con_Sam + Cue_Pro + Cue_Sam_Pro +          Cue_Con_Sam_Pro + Cue_Ali_Sam_Pro + Cue_Con_Ali_Sam_Pro |          Participant)
##    Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  41926.0  42512.2 -20895.0  41790.0    40892 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.3720 -0.5860  0.2749  0.5384  3.5224 
## 
## Random effects:
##  Groups      Name                Variance Std.Dev. Corr                                     
##  Participant Cue_Sam             0.5906   0.7685                                            
##              Con_Sam             0.3907   0.6251    0.22                                    
##              Cue_Con_Sam         1.0738   1.0363    0.87  0.37                              
##              Cue_Pro             0.4212   0.6490   -0.07  0.03  0.04                        
##              Cue_Sam_Pro         2.5569   1.5990   -0.24 -0.09 -0.18  0.01                  
##              Cue_Con_Sam_Pro     2.2046   1.4848   -0.01  0.57 -0.08 -0.10  0.19            
##              Cue_Ali_Sam_Pro     0.1210   0.3478    0.32  0.17  0.03 -0.05  0.16  0.40      
##              Cue_Con_Ali_Sam_Pro 0.6926   0.8322   -0.39 -0.56 -0.31  0.26  0.28 -0.72 -0.58
## Number of obs: 40960, groups:  Participant, 32
## 
## Fixed effects:
##                                                                                            Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                                1.065368   0.047269  22.538  < 2e-16 ***
## Cuebottom                                                                                  0.126927   0.062066   2.045 0.040851 *  
## Congruencyincongruent                                                                     -0.822358   0.073228 -11.230  < 2e-16 ***
## Alignmentmisaligned                                                                       -0.162130   0.047841  -3.389 0.000702 ***
## SameDifferentdifferent                                                                    -1.918752   0.079915 -24.010  < 2e-16 ***
## Probability2-1                                                                             0.463426   0.116323   3.984 6.78e-05 ***
## Cuebottom:Congruencyincongruent                                                            0.057438   0.112941   0.509 0.611054    
## Cuebottom:Alignmentmisaligned                                                              0.006756   0.069246   0.098 0.922276    
## Congruencyincongruent:Alignmentmisaligned                                                  0.484561   0.064370   7.528 5.16e-14 ***
## Cuebottom:SameDifferentdifferent                                                           0.123210   0.098882   1.246 0.212753    
## Congruencyincongruent:SameDifferentdifferent                                               1.346494   0.130855  10.290  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                                 0.304934   0.065923   4.626 3.74e-06 ***
## Cuebottom:Probability2-1                                                                  -0.751581   0.212449  -3.538 0.000404 ***
## Congruencyincongruent:Probability2-1                                                       0.105583   0.121221   0.871 0.383757    
## Alignmentmisaligned:Probability2-1                                                        -0.070257   0.100458  -0.699 0.484326    
## SameDifferentdifferent:Probability2-1                                                     -0.761049   0.184328  -4.129 3.65e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                                       -0.288252   0.092384  -3.120 0.001808 ** 
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                                    -0.178150   0.204170  -0.873 0.382906    
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                                      -0.131320   0.093467  -1.405 0.160024    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                          -0.754975   0.089568  -8.429  < 2e-16 ***
## Cuebottom:Congruencyincongruent:Probability2-1                                            -0.400302   0.206614  -1.937 0.052692 .  
## Cuebottom:Alignmentmisaligned:Probability2-1                                               0.030144   0.151694   0.199 0.842484    
## Congruencyincongruent:Alignmentmisaligned:Probability2-1                                   0.107291   0.134283   0.799 0.424297    
## Cuebottom:SameDifferentdifferent:Probability2-1                                            1.303589   0.343517   3.795 0.000148 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1                               -0.239896   0.203854  -1.177 0.239274    
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1                                  0.177388   0.145468   1.219 0.222681    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                 0.556425   0.126888   4.385 1.16e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1                        -0.120176   0.199616  -0.602 0.547151    
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1                      0.727077   0.365982   1.987 0.046962 *  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1                       -0.134409   0.224072  -0.600 0.548606    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1           -0.259861   0.194882  -1.333 0.182392    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1  0.401627   0.296117   1.356 0.175000    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E2_resp_etd1))
## $Participant
## Importance of components:
##                         [,1]   [,2]   [,3]   [,4]    [,5]    [,6]    [,7]      [,8]
## Standard deviation     1.735 1.6457 1.1942 0.6756 0.49154 0.36189 0.27765 1.039e-05
## Proportion of Variance 0.374 0.3364 0.1771 0.0567 0.03001 0.01627 0.00957 0.000e+00
## Cumulative Proportion  0.374 0.7103 0.8874 0.9442 0.97416 0.99043 1.00000 1.000e+00

Cue_Ali_Sam_Pro, and Con_Sam were removed from extended model (glmm_E2_resp_etd1) due to that the variances they explained were smaller than 1%, making glmm_E2_resp_etd2.

file_E2_resp_etd2 <- file.path(folder_lmm, "E2_Resp_lmm_etd2.RData")

# fit the etd2 model
if (!file.exists(file_E2_resp_etd2)) {
  glmm_E2_resp_etd2 <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + 
      (0 + # Con_C + Ali_C + Cue_C + Sam_C + 
         Cue_Sam +  # Con_Ali + Ali_Sam + Cue_Con + Cue_Ali + Con_Sam + 
         Cue_Con_Sam + # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam +  
         # Cue_Con_Ali_Sam +
         # Pro_C + 
         Cue_Pro + # Con_Pro + Ali_Pro + Sam_Pro + 
         Cue_Sam_Pro + # Ali_Sam_Pro + Cue_Con_Pro + Con_Ali_Pro + Cue_Ali_Pro + Con_Sam_Pro + 
         Cue_Con_Sam_Pro + # Con_Ali_Sam_Pro + Cue_Con_Ali_Pro + Cue_Ali_Sam_Pro + 
         Cue_Con_Ali_Sam_Pro | Participant),
    family = binomial(link = "probit"),
    data = df_lmm_E2,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E2_resp_etd2, file = file_E2_resp_etd2)
} else {
  load(file_E2_resp_etd2)
}

print(summary(glmm_E2_resp_etd2), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +      (0 + Cue_Sam + Cue_Con_Sam + Cue_Pro + Cue_Sam_Pro + Cue_Con_Sam_Pro +          Cue_Con_Ali_Sam_Pro | Participant)
##    Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  42204.6  42661.5 -21049.3  42098.6    40907 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -6.7184 -0.6074  0.2827  0.5353  4.0992 
## 
## Random effects:
##  Groups      Name                Variance Std.Dev. Corr                         
##  Participant Cue_Sam             0.5933   0.7702                                
##              Cue_Con_Sam         1.1571   1.0757    0.87                        
##              Cue_Pro             0.4151   0.6443   -0.08  0.03                  
##              Cue_Sam_Pro         2.5745   1.6045   -0.25 -0.18  0.01            
##              Cue_Con_Sam_Pro     1.7821   1.3349   -0.20 -0.41 -0.10  0.27      
##              Cue_Con_Ali_Sam_Pro 0.3644   0.6037   -0.49 -0.45  0.40  0.42 -0.38
## Number of obs: 40960, groups:  Participant, 32
## 
## Fixed effects:
##                                                                                           Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                                1.05243    0.03888  27.070  < 2e-16 ***
## Cuebottom                                                                                  0.11590    0.06142   1.887 0.059138 .  
## Congruencyincongruent                                                                     -0.80308    0.06609 -12.151  < 2e-16 ***
## Alignmentmisaligned                                                                       -0.15843    0.04741  -3.341 0.000833 ***
## SameDifferentdifferent                                                                    -1.89558    0.05949 -31.862  < 2e-16 ***
## Probability2-1                                                                             0.48478    0.11363   4.266 1.99e-05 ***
## Cuebottom:Congruencyincongruent                                                            0.06424    0.11584   0.555 0.579230    
## Cuebottom:Alignmentmisaligned                                                              0.01383    0.06842   0.202 0.839856    
## Congruencyincongruent:Alignmentmisaligned                                                  0.48017    0.06396   7.508 6.02e-14 ***
## Cuebottom:SameDifferentdifferent                                                           0.13255    0.09821   1.350 0.177113    
## Congruencyincongruent:SameDifferentdifferent                                               1.30716    0.11474  11.392  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                                 0.30055    0.06536   4.599 4.25e-06 ***
## Cuebottom:Probability2-1                                                                  -0.81512    0.20646  -3.948 7.88e-05 ***
## Congruencyincongruent:Probability2-1                                                       0.07572    0.11354   0.667 0.504852    
## Alignmentmisaligned:Probability2-1                                                        -0.08504    0.09628  -0.883 0.377094    
## SameDifferentdifferent:Probability2-1                                                     -0.80384    0.17693  -4.543 5.54e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                                       -0.29510    0.09145  -3.227 0.001251 ** 
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                                    -0.17733    0.21100  -0.840 0.400663    
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                                      -0.13908    0.09256  -1.503 0.132953    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                          -0.74693    0.08906  -8.387  < 2e-16 ***
## Cuebottom:Congruencyincongruent:Probability2-1                                            -0.31900    0.18803  -1.697 0.089788 .  
## Cuebottom:Alignmentmisaligned:Probability2-1                                               0.06144    0.14100   0.436 0.663031    
## Congruencyincongruent:Alignmentmisaligned:Probability2-1                                   0.12029    0.13133   0.916 0.359701    
## Cuebottom:SameDifferentdifferent:Probability2-1                                            1.39844    0.32765   4.268 1.97e-05 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1                               -0.17425    0.18472  -0.943 0.345528    
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1                                  0.20587    0.13419   1.534 0.124989    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                 0.55866    0.12589   4.438 9.09e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1                        -0.14669    0.19247  -0.762 0.445969    
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1                      0.59352    0.32247   1.841 0.065690 .  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1                       -0.18205    0.19499  -0.934 0.350503    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1           -0.28687    0.18706  -1.534 0.125135    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1  0.44075    0.27631   1.595 0.110683    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1 
## Model failed to converge with max|grad| = 0.00161086 (tol = 0.001, component 1)
file_E2_resp_etd3 <- file.path(folder_lmm, "E2_Resp_lmm_etd3.RData")

# fit the etd3 model
if (!file.exists(file_E2_resp_etd3)) {
  
  ss <- getME(glmm_E2_resp_etd2, c("theta","fixef"))
  glmm_E2_resp_etd3 <- update(
    glmm_E2_resp_etd2, start=ss,
    control=glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                         optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE)))
  # save(glmm_E2_resp_etd3, file = file_E2_resp_etd3)
} else {
  load(file_E2_resp_etd3)
}

print(summary(glmm_E2_resp_etd3), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +      (0 + Cue_Sam + Cue_Con_Sam + Cue_Pro + Cue_Sam_Pro + Cue_Con_Sam_Pro +          Cue_Con_Ali_Sam_Pro | Participant)
##    Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  42204.6  42661.5 -21049.3  42098.6    40907 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -6.7184 -0.6074  0.2827  0.5353  4.0992 
## 
## Random effects:
##  Groups      Name                Variance Std.Dev. Corr                         
##  Participant Cue_Sam             0.5932   0.7702                                
##              Cue_Con_Sam         1.1569   1.0756    0.87                        
##              Cue_Pro             0.4151   0.6443   -0.08  0.03                  
##              Cue_Sam_Pro         2.5747   1.6046   -0.25 -0.18  0.01            
##              Cue_Con_Sam_Pro     1.7820   1.3349   -0.20 -0.41 -0.10  0.27      
##              Cue_Con_Ali_Sam_Pro 0.3644   0.6036   -0.49 -0.45  0.40  0.42 -0.38
## Number of obs: 40960, groups:  Participant, 32
## 
## Fixed effects:
##                                                                                           Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                                1.05243    0.03867  27.213  < 2e-16 ***
## Cuebottom                                                                                  0.11590    0.06120   1.894 0.058249 .  
## Congruencyincongruent                                                                     -0.80308    0.06549 -12.263  < 2e-16 ***
## Alignmentmisaligned                                                                       -0.15843    0.04723  -3.354 0.000795 ***
## SameDifferentdifferent                                                                    -1.89558    0.05906 -32.098  < 2e-16 ***
## Probability2-1                                                                             0.48478    0.11188   4.333 1.47e-05 ***
## Cuebottom:Congruencyincongruent                                                            0.06424    0.11484   0.559 0.575917    
## Cuebottom:Alignmentmisaligned                                                              0.01383    0.06823   0.203 0.839430    
## Congruencyincongruent:Alignmentmisaligned                                                  0.48017    0.06363   7.546 4.47e-14 ***
## Cuebottom:SameDifferentdifferent                                                           0.13255    0.09775   1.356 0.175109    
## Congruencyincongruent:SameDifferentdifferent                                               1.30716    0.11366  11.501  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                                 0.30055    0.06492   4.630 3.66e-06 ***
## Cuebottom:Probability2-1                                                                  -0.81512    0.20305  -4.014 5.96e-05 ***
## Congruencyincongruent:Probability2-1                                                       0.07572    0.11037   0.686 0.492703    
## Alignmentmisaligned:Probability2-1                                                        -0.08504    0.09467  -0.898 0.368998    
## SameDifferentdifferent:Probability2-1                                                     -0.80384    0.17290  -4.649 3.34e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                                       -0.29510    0.09113  -3.238 0.001202 ** 
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                                    -0.17733    0.20925  -0.847 0.396728    
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                                      -0.13908    0.09211  -1.510 0.131055    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                          -0.74693    0.08833  -8.457  < 2e-16 ***
## Cuebottom:Congruencyincongruent:Probability2-1                                            -0.31900    0.18157  -1.757 0.078940 .  
## Cuebottom:Alignmentmisaligned:Probability2-1                                               0.06144    0.13778   0.446 0.655674    
## Congruencyincongruent:Alignmentmisaligned:Probability2-1                                   0.12029    0.12891   0.933 0.350730    
## Cuebottom:SameDifferentdifferent:Probability2-1                                            1.39844    0.32002   4.370 1.24e-05 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1                               -0.17425    0.17857  -0.976 0.329167    
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1                                  0.20587    0.13109   1.570 0.116314    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                 0.55866    0.12517   4.463 8.07e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1                        -0.14669    0.18728  -0.783 0.433455    
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1                      0.59352    0.31060   1.911 0.056024 .  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1                       -0.18205    0.18920  -0.962 0.335966    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1           -0.28687    0.18205  -1.576 0.115074    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1  0.44075    0.26661   1.653 0.098299 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1 
## Model failed to converge with max|grad| = 0.0021675 (tol = 0.001, component 1)
summary(rePCA(glmm_E2_resp_etd3))
## $Participant
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]      [,6]
## Standard deviation     1.7897 1.3385 1.1614 0.65483 0.33749 0.0001623
## Proportion of Variance 0.4652 0.2602 0.1959 0.06227 0.01654 0.0000000
## Cumulative Proportion  0.4652 0.7253 0.9212 0.98346 1.00000 1.0000000

Cue_Con_Ali_Sam_Pro was removed from extended model (glmm_E2_resp_etd3) due to that the variances it explained were smaller than 1%, making glmm_E2_resp_etd4.

file_E2_resp_etd4 <- file.path(folder_lmm, "E2_Resp_lmm_etd4.RData")

# fit the etd4 model
if (!file.exists(file_E2_resp_etd4)) {
  glmm_E2_resp_etd4 <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + 
      (0 + # Con_C + Ali_C + Cue_C + Sam_C + 
         Cue_Sam +  # Con_Ali + Ali_Sam + Cue_Con + Cue_Ali + Con_Sam + 
         Cue_Con_Sam + # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam +  
         # Cue_Con_Ali_Sam +
         # Pro_C + 
         Cue_Pro + # Con_Pro + Ali_Pro + Sam_Pro + 
         Cue_Sam_Pro + # Ali_Sam_Pro + Cue_Con_Pro + Con_Ali_Pro + Cue_Ali_Pro + Con_Sam_Pro + 
         Cue_Con_Sam_Pro # Con_Ali_Sam_Pro + Cue_Con_Ali_Pro + Cue_Ali_Sam_Pro + + Cue_Con_Ali_Sam_Pro
       | Participant),
    family = binomial(link = "probit"),
    data = df_lmm_E2,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E2_resp_etd4, file = file_E2_resp_etd4)
} else {
  load(file_E2_resp_etd4)
}

print(summary(glmm_E2_resp_etd4), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +      (0 + Cue_Sam + Cue_Con_Sam + Cue_Pro + Cue_Sam_Pro + Cue_Con_Sam_Pro |          Participant)
##    Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  42198.4  42603.6 -21052.2  42104.4    40913 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -6.4599 -0.6086  0.2839  0.5376  4.0136 
## 
## Random effects:
##  Groups      Name            Variance Std.Dev. Corr                   
##  Participant Cue_Sam         0.5939   0.7707                          
##              Cue_Con_Sam     1.1556   1.0750    0.87                  
##              Cue_Pro         0.4156   0.6447   -0.08  0.03            
##              Cue_Sam_Pro     2.5692   1.6029   -0.24 -0.18  0.01      
##              Cue_Con_Sam_Pro 1.7694   1.3302   -0.20 -0.41 -0.10  0.27
## Number of obs: 40960, groups:  Participant, 32
## 
## Fixed effects:
##                                                                                           Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                                1.05176    0.03874  27.147  < 2e-16 ***
## Cuebottom                                                                                  0.11557    0.06129   1.886 0.059347 .  
## Congruencyincongruent                                                                     -0.80278    0.06584 -12.194  < 2e-16 ***
## Alignmentmisaligned                                                                       -0.15744    0.04727  -3.331 0.000866 ***
## SameDifferentdifferent                                                                    -1.89315    0.05924 -31.959  < 2e-16 ***
## Probability2-1                                                                             0.48388    0.11091   4.363 1.29e-05 ***
## Cuebottom:Congruencyincongruent                                                            0.06502    0.11547   0.563 0.573373    
## Cuebottom:Alignmentmisaligned                                                              0.01428    0.06836   0.209 0.834536    
## Congruencyincongruent:Alignmentmisaligned                                                  0.47993    0.06375   7.528 5.15e-14 ***
## Cuebottom:SameDifferentdifferent                                                           0.13278    0.09793   1.356 0.175151    
## Congruencyincongruent:SameDifferentdifferent                                               1.30486    0.11430  11.416  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                                 0.29666    0.06509   4.557 5.18e-06 ***
## Cuebottom:Probability2-1                                                                  -0.81193    0.20047  -4.050 5.12e-05 ***
## Congruencyincongruent:Probability2-1                                                       0.07495    0.10841   0.691 0.489322    
## Alignmentmisaligned:Probability2-1                                                        -0.08376    0.09446  -0.887 0.375222    
## SameDifferentdifferent:Probability2-1                                                     -0.80115    0.16663  -4.808 1.52e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                                       -0.29665    0.09133  -3.248 0.001161 ** 
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                                    -0.17822    0.21033  -0.847 0.396810    
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                                      -0.13962    0.09237  -1.512 0.130648    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                          -0.74289    0.08870  -8.375  < 2e-16 ***
## Cuebottom:Congruencyincongruent:Probability2-1                                            -0.32117    0.17589  -1.826 0.067853 .  
## Cuebottom:Alignmentmisaligned:Probability2-1                                               0.05622    0.13651   0.412 0.680441    
## Congruencyincongruent:Alignmentmisaligned:Probability2-1                                   0.12276    0.12730   0.964 0.334893    
## Cuebottom:SameDifferentdifferent:Probability2-1                                            1.39232    0.30536   4.560 5.13e-06 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1                               -0.17475    0.17314  -1.009 0.312836    
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1                                  0.20194    0.13008   1.552 0.120579    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                 0.56031    0.12553   4.464 8.06e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1                        -0.14297    0.18228  -0.784 0.432829    
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1                      0.59909    0.29614   2.023 0.043073 *  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1                       -0.17184    0.18454  -0.931 0.351765    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1           -0.28785    0.17724  -1.624 0.104364    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1  0.43092    0.25103   1.717 0.086052 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00120721 (tol = 0.001, component 1)
file_E2_resp_etd5 <- file.path(folder_lmm, "E2_Resp_lmm_etd5.RData")

# fit the etd5 model
if (!file.exists(file_E2_resp_etd5)) {
  
  ss <- getME(glmm_E2_resp_etd4, c("theta","fixef"))
  glmm_E2_resp_etd5 <- update(
    glmm_E2_resp_etd4, start=ss,
    control=glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                         optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE)))
  # save(glmm_E2_resp_etd5, file = file_E2_resp_etd5)
} else {
  load(file_E2_resp_etd5)
}

print(summary(glmm_E2_resp_etd5), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +      (0 + Cue_Sam + Cue_Con_Sam + Cue_Pro + Cue_Sam_Pro + Cue_Con_Sam_Pro |          Participant)
##    Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  42198.4  42603.6 -21052.2  42104.4    40913 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -6.4599 -0.6086  0.2839  0.5376  4.0135 
## 
## Random effects:
##  Groups      Name            Variance Std.Dev. Corr                   
##  Participant Cue_Sam         0.5939   0.7706                          
##              Cue_Con_Sam     1.1554   1.0749    0.87                  
##              Cue_Pro         0.4156   0.6447   -0.08  0.03            
##              Cue_Sam_Pro     2.5695   1.6030   -0.24 -0.18  0.01      
##              Cue_Con_Sam_Pro 1.7693   1.3301   -0.20 -0.41 -0.10  0.27
## Number of obs: 40960, groups:  Participant, 32
## 
## Fixed effects:
##                                                                                           Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                                1.05176    0.03854  27.292  < 2e-16 ***
## Cuebottom                                                                                  0.11557    0.06102   1.894 0.058249 .  
## Congruencyincongruent                                                                     -0.80278    0.06508 -12.335  < 2e-16 ***
## Alignmentmisaligned                                                                       -0.15744    0.04701  -3.349 0.000811 ***
## SameDifferentdifferent                                                                    -1.89315    0.05884 -32.174  < 2e-16 ***
## Probability2-1                                                                             0.48388    0.10960   4.415 1.01e-05 ***
## Cuebottom:Congruencyincongruent                                                            0.06502    0.11415   0.570 0.568940    
## Cuebottom:Alignmentmisaligned                                                              0.01428    0.06802   0.210 0.833708    
## Congruencyincongruent:Alignmentmisaligned                                                  0.47993    0.06335   7.575 3.59e-14 ***
## Cuebottom:SameDifferentdifferent                                                           0.13278    0.09748   1.362 0.173169    
## Congruencyincongruent:SameDifferentdifferent                                               1.30486    0.11274  11.574  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                                 0.29666    0.06459   4.593 4.37e-06 ***
## Cuebottom:Probability2-1                                                                  -0.81193    0.19808  -4.099 4.15e-05 ***
## Congruencyincongruent:Probability2-1                                                       0.07495    0.10658   0.703 0.481910    
## Alignmentmisaligned:Probability2-1                                                        -0.08376    0.09347  -0.896 0.370187    
## SameDifferentdifferent:Probability2-1                                                     -0.80115    0.16416  -4.880 1.06e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                                       -0.29665    0.09088  -3.264 0.001097 ** 
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                                    -0.17822    0.20761  -0.858 0.390652    
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                                      -0.13962    0.09178  -1.521 0.128201    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                          -0.74289    0.08792  -8.449  < 2e-16 ***
## Cuebottom:Congruencyincongruent:Probability2-1                                            -0.32117    0.17252  -1.862 0.062657 .  
## Cuebottom:Alignmentmisaligned:Probability2-1                                               0.05622    0.13463   0.418 0.676239    
## Congruencyincongruent:Alignmentmisaligned:Probability2-1                                   0.12276    0.12586   0.975 0.329387    
## Cuebottom:SameDifferentdifferent:Probability2-1                                            1.39232    0.30097   4.626 3.73e-06 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1                               -0.17475    0.16950  -1.031 0.302554    
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1                                  0.20194    0.12814   1.576 0.115048    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                 0.56031    0.12472   4.492 7.04e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1                        -0.14297    0.17941  -0.797 0.425519    
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1                      0.59909    0.28969   2.068 0.038635 *  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1                       -0.17184    0.18106  -0.949 0.342595    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1           -0.28785    0.17427  -1.652 0.098582 .  
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1  0.43092    0.24538   1.756 0.079067 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1 
## Model failed to converge with max|grad| = 0.00217891 (tol = 0.001, component 1)
summary(rePCA(glmm_E2_resp_etd5))
## $Participant
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]
## Standard deviation     1.7783 1.3185 1.0569 0.64072 0.27414
## Proportion of Variance 0.4862 0.2673 0.1718 0.06312 0.01156
## Cumulative Proportion  0.4862 0.7536 0.9253 0.98844 1.00000

Cue_Pro was removed from extended model (glmm_E2_resp_etd5) due to that the variances it explained were smaller than 1%, making glmm_E2_resp_etd6.

file_E2_resp_etd6 <- file.path(folder_lmm, "E2_Resp_lmm_etd6.RData")

# fit the etd6 model
if (!file.exists(file_E2_resp_etd6)) {
  glmm_E2_resp_etd6 <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + 
      (0 + # Con_C + Ali_C + Cue_C + Sam_C + 
         Cue_Sam +  # Con_Ali + Ali_Sam + Cue_Con + Cue_Ali + Con_Sam + 
         Cue_Con_Sam + # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam +  
         # Cue_Con_Ali_Sam +
         # Pro_C + 
         # Con_Pro + Ali_Pro + Sam_Pro + Cue_Pro + 
         Cue_Sam_Pro + # Ali_Sam_Pro + Cue_Con_Pro + Con_Ali_Pro + Cue_Ali_Pro + Con_Sam_Pro + 
         Cue_Con_Sam_Pro # Con_Ali_Sam_Pro + Cue_Con_Ali_Pro + Cue_Ali_Sam_Pro + + Cue_Con_Ali_Sam_Pro
       | Participant),
    family = binomial(link = "probit"),
    data = df_lmm_E2,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E2_resp_etd6, file = file_E2_resp_etd6)
} else {
  load(file_E2_resp_etd6)
}

print(summary(glmm_E2_resp_etd6), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +      (0 + Cue_Sam + Cue_Con_Sam + Cue_Sam_Pro + Cue_Con_Sam_Pro |          Participant)
##    Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  42628.4  42990.5 -21272.2  42544.4    40918 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.3192 -0.6160  0.2881  0.5504  4.1087 
## 
## Random effects:
##  Groups      Name            Variance Std.Dev. Corr             
##  Participant Cue_Sam         0.5961   0.772                     
##              Cue_Con_Sam     1.1423   1.069     0.86            
##              Cue_Sam_Pro     2.5914   1.610    -0.25 -0.18      
##              Cue_Con_Sam_Pro 1.8149   1.347    -0.18 -0.41  0.21
## Number of obs: 40960, groups:  Participant, 32
## 
## Fixed effects:
##                                                                                           Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                                1.04400    0.03863  27.029  < 2e-16 ***
## Cuebottom                                                                                  0.11384    0.06126   1.858 0.063141 .  
## Congruencyincongruent                                                                     -0.79866    0.06513 -12.262  < 2e-16 ***
## Alignmentmisaligned                                                                       -0.15812    0.04699  -3.365 0.000765 ***
## SameDifferentdifferent                                                                    -1.87894    0.05919 -31.744  < 2e-16 ***
## Probability2-1                                                                             0.46310    0.09769   4.740 2.13e-06 ***
## Cuebottom:Congruencyincongruent                                                            0.06592    0.11428   0.577 0.564029    
## Cuebottom:Alignmentmisaligned                                                              0.01625    0.06793   0.239 0.810968    
## Congruencyincongruent:Alignmentmisaligned                                                  0.47686    0.06335   7.527 5.19e-14 ***
## Cuebottom:SameDifferentdifferent                                                           0.13508    0.09819   1.376 0.168917    
## Congruencyincongruent:SameDifferentdifferent                                               1.29626    0.11297  11.475  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                                 0.29716    0.06466   4.596 4.31e-06 ***
## Cuebottom:Probability2-1                                                                  -0.77821    0.17191  -4.527 5.98e-06 ***
## Congruencyincongruent:Probability2-1                                                       0.09082    0.10744   0.845 0.397969    
## Alignmentmisaligned:Probability2-1                                                        -0.07939    0.09375  -0.847 0.397053    
## SameDifferentdifferent:Probability2-1                                                     -0.77253    0.16871  -4.579 4.67e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                                       -0.29537    0.09070  -3.257 0.001127 ** 
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                                    -0.17950    0.20809  -0.863 0.388349    
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                                      -0.14209    0.09169  -1.550 0.121211    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                          -0.73732    0.08801  -8.377  < 2e-16 ***
## Cuebottom:Congruencyincongruent:Probability2-1                                            -0.34341    0.17504  -1.962 0.049775 *  
## Cuebottom:Alignmentmisaligned:Probability2-1                                               0.05225    0.13589   0.384 0.700610    
## Congruencyincongruent:Alignmentmisaligned:Probability2-1                                   0.11591    0.12629   0.918 0.358716    
## Cuebottom:SameDifferentdifferent:Probability2-1                                            1.33920    0.31121   4.303 1.68e-05 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1                               -0.18728    0.17154  -1.092 0.274955    
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1                                  0.19687    0.12910   1.525 0.127272    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                 0.55742    0.12452   4.476 7.59e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1                        -0.13464    0.18129  -0.743 0.457684    
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1                      0.61845    0.29449   2.100 0.035722 *  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1                       -0.16449    0.18352  -0.896 0.370076    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1           -0.28008    0.17539  -1.597 0.110295    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1  0.41619    0.24859   1.674 0.094092 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00127145 (tol = 0.001, component 1)

3.1.1.5 The optimal model

# compare the extended and reduced model
anova(glmm_E2_resp_etd6, glmm_E2_resp_rdc2, refit = FALSE)
## Data: df_lmm_E2
## Models:
## glmm_E2_resp_etd6: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + 
## glmm_E2_resp_etd6:     (0 + Cue_Sam + Cue_Con_Sam + Cue_Sam_Pro + Cue_Con_Sam_Pro | 
## glmm_E2_resp_etd6:         Participant)
## glmm_E2_resp_rdc2: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability + 
## glmm_E2_resp_rdc2:     (Cue_C + Sam_C + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam + 
## glmm_E2_resp_rdc2:         Con_Ali_Sam + Cue_Con_Ali_Sam + Pro_C + Cue_Pro + Sam_Pro + 
## glmm_E2_resp_rdc2:         Cue_Ali_Pro + Cue_Sam_Pro + Con_Sam_Pro + Cue_Con_Sam_Pro + 
## glmm_E2_resp_rdc2:         Cue_Ali_Sam_Pro + Cue_Con_Ali_Sam_Pro || Participant)
##                   npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)    
## glmm_E2_resp_etd6   42 42628 42990 -21272    42544                         
## glmm_E2_resp_rdc2   50 39575 40006 -19738    39475 3069.2  8  < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

According to BIC, the reduced model (glmm_E2_resp_rdc2) explained the data better than the extended model (glmm_resp_etd4) and, therefore, the reduced model is used as the optimal model.

glmm_E2_resp_opt <- glmm_E2_resp_rdc2

print(summary(glmm_E2_resp_opt), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent * Probability +      (Cue_C + Sam_C + Cue_Ali + Cue_Sam + Con_Sam + Cue_Con_Sam +          Con_Ali_Sam + Cue_Con_Ali_Sam + Pro_C + Cue_Pro + Sam_Pro +          Cue_Ali_Pro + Cue_Sam_Pro + Con_Sam_Pro + Cue_Con_Sam_Pro +          Cue_Ali_Sam_Pro + Cue_Con_Ali_Sam_Pro || Participant)
##    Data: df_lmm_E2
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  39575.2  40006.3 -19737.6  39475.2    40910 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -10.6455  -0.5528   0.1967   0.5113   5.7139 
## 
## Random effects:
##  Groups         Name                Variance Std.Dev.
##  Participant    (Intercept)         0.07145  0.2673  
##  Participant.1  Cue_C               0.12947  0.3598  
##  Participant.2  Sam_C               0.19931  0.4464  
##  Participant.3  Cue_Ali             0.04192  0.2047  
##  Participant.4  Cue_Sam             0.58683  0.7660  
##  Participant.5  Con_Sam             0.38364  0.6194  
##  Participant.6  Cue_Con_Sam         1.15766  1.0759  
##  Participant.7  Con_Ali_Sam         0.10035  0.3168  
##  Participant.8  Cue_Con_Ali_Sam     0.07774  0.2788  
##  Participant.9  Pro_C               0.05713  0.2390  
##  Participant.10 Cue_Pro             0.40833  0.6390  
##  Participant.11 Sam_Pro             0.04196  0.2048  
##  Participant.12 Cue_Ali_Pro         0.10085  0.3176  
##  Participant.13 Cue_Sam_Pro         1.54889  1.2445  
##  Participant.14 Con_Sam_Pro         0.12625  0.3553  
##  Participant.15 Cue_Con_Sam_Pro     2.48434  1.5762  
##  Participant.16 Cue_Ali_Sam_Pro     0.08956  0.2993  
##  Participant.17 Cue_Con_Ali_Sam_Pro 0.09184  0.3030  
## Number of obs: 40960, groups:  Participant, 32
## 
## Fixed effects:
##                                                                                            Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                                                                1.164756   0.093859  12.410  < 2e-16 ***
## Cuebottom                                                                                  0.133595   0.119396   1.119  0.26317    
## Congruencyincongruent                                                                     -0.919451   0.088659 -10.371  < 2e-16 ***
## Alignmentmisaligned                                                                       -0.175552   0.056182  -3.125  0.00178 ** 
## SameDifferentdifferent                                                                    -2.082488   0.137486 -15.147  < 2e-16 ***
## Probability2-1                                                                             0.504191   0.124335   4.055 5.01e-05 ***
## Cuebottom:Congruencyincongruent                                                            0.082452   0.119261   0.691  0.48934    
## Cuebottom:Alignmentmisaligned                                                             -0.002788   0.083158  -0.034  0.97325    
## Congruencyincongruent:Alignmentmisaligned                                                  0.535632   0.074313   7.208 5.69e-13 ***
## Cuebottom:SameDifferentdifferent                                                           0.144981   0.180905   0.801  0.42289    
## Congruencyincongruent:SameDifferentdifferent                                               1.484362   0.162668   9.125  < 2e-16 ***
## Alignmentmisaligned:SameDifferentdifferent                                                 0.327358   0.075751   4.322 1.55e-05 ***
## Cuebottom:Probability2-1                                                                  -0.800391   0.204913  -3.906 9.38e-05 ***
## Congruencyincongruent:Probability2-1                                                       0.113429   0.123145   0.921  0.35699    
## Alignmentmisaligned:Probability2-1                                                        -0.071931   0.106629  -0.675  0.49994    
## SameDifferentdifferent:Probability2-1                                                     -0.786107   0.171382  -4.587 4.50e-06 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                                       -0.319841   0.100426  -3.185  0.00145 ** 
## Cuebottom:Congruencyincongruent:SameDifferentdifferent                                    -0.226218   0.214466  -1.055  0.29152    
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent                                      -0.126699   0.101285  -1.251  0.21097    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                          -0.820362   0.111485  -7.358 1.86e-13 ***
## Cuebottom:Congruencyincongruent:Probability2-1                                            -0.441981   0.197312  -2.240  0.02509 *  
## Cuebottom:Alignmentmisaligned:Probability2-1                                               0.041045   0.160452   0.256  0.79810    
## Congruencyincongruent:Alignmentmisaligned:Probability2-1                                   0.120043   0.136301   0.881  0.37847    
## Cuebottom:SameDifferentdifferent:Probability2-1                                            1.351061   0.297076   4.548 5.42e-06 ***
## Congruencyincongruent:SameDifferentdifferent:Probability2-1                               -0.270287   0.202271  -1.336  0.18146    
## Alignmentmisaligned:SameDifferentdifferent:Probability2-1                                  0.179901   0.141997   1.267  0.20518    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent                 0.601164   0.140948   4.265 2.00e-05 ***
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1                        -0.134248   0.196907  -0.682  0.49538    
## Cuebottom:Congruencyincongruent:SameDifferentdifferent:Probability2-1                      0.790854   0.336433   2.351  0.01874 *  
## Cuebottom:Alignmentmisaligned:SameDifferentdifferent:Probability2-1                       -0.144169   0.205911  -0.700  0.48383    
## Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1           -0.284773   0.188893  -1.508  0.13166    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:SameDifferentdifferent:Probability2-1  0.426096   0.270915   1.573  0.11576    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

3.1.2 Estimated marginal means

3.1.2.1 Estimated marginal means for hit and false alarm

(emm_E2_resp <- emmeans(glmm_E2_resp_opt, ~ Alignment + Congruency + Cue + SameDifferent + Probability))
##  Alignment  Congruency  Cue    SameDifferent Probability  emmean    SE  df asymp.LCL asymp.UCL
##  aligned    congruent   top    same          0.25         0.9127 0.116 Inf    0.6844    1.1409
##  misaligned congruent   top    same          0.25         0.7731 0.116 Inf    0.5464    0.9997
##  aligned    incongruent top    same          0.25        -0.0635 0.113 Inf   -0.2850    0.1580
##  misaligned incongruent top    same          0.25         0.2725 0.113 Inf    0.0501    0.4950
##  aligned    congruent   bottom same          0.25         1.4465 0.109 Inf    1.2332    1.6597
##  misaligned congruent   bottom same          0.25         1.2836 0.107 Inf    1.0730    1.4941
##  aligned    incongruent bottom same          0.25         0.7737 0.106 Inf    0.5669    0.9805
##  misaligned incongruent bottom same          0.25         0.8337 0.106 Inf    0.6264    1.0411
##  aligned    congruent   top    different     0.25        -0.7768 0.115 Inf   -1.0027   -0.5508
##  misaligned congruent   top    different     0.25        -0.6790 0.115 Inf   -0.9035   -0.4544
##  aligned    incongruent top    different     0.25        -0.1334 0.113 Inf   -0.3543    0.0874
##  misaligned incongruent top    different     0.25        -0.2380 0.113 Inf   -0.4589   -0.0171
##  aligned    congruent   bottom different     0.25        -0.7735 0.105 Inf   -0.9795   -0.5675
##  misaligned congruent   bottom different     0.25        -0.7536 0.105 Inf   -0.9594   -0.5478
##  aligned    incongruent bottom different     0.25        -0.4484 0.105 Inf   -0.6532   -0.2435
##  misaligned incongruent bottom different     0.25        -0.4955 0.105 Inf   -0.7004   -0.2906
##  aligned    congruent   top    same          0.75         1.4169 0.109 Inf    1.2041    1.6296
##  misaligned congruent   top    same          0.75         1.2053 0.107 Inf    0.9955    1.4152
##  aligned    incongruent top    same          0.75         0.5541 0.105 Inf    0.3492    0.7590
##  misaligned incongruent top    same          0.75         0.9383 0.106 Inf    0.7308    1.1457
##  aligned    congruent   bottom same          0.75         1.1503 0.119 Inf    0.9166    1.3839
##  misaligned congruent   bottom same          0.75         0.9565 0.117 Inf    0.7274    1.1855
##  aligned    incongruent bottom same          0.75         0.1490 0.113 Inf   -0.0728    0.3707
##  misaligned incongruent bottom same          0.75         0.1639 0.113 Inf   -0.0579    0.3857
##  aligned    congruent   top    different     0.75        -1.0587 0.106 Inf   -1.2664   -0.8510
##  misaligned congruent   top    different     0.75        -0.8529 0.105 Inf   -1.0590   -0.6468
##  aligned    incongruent top    different     0.75        -0.5722 0.105 Inf   -0.7771   -0.3673
##  misaligned incongruent top    different     0.75        -0.7335 0.105 Inf   -0.9392   -0.5278
##  aligned    congruent   bottom different     0.75        -0.5048 0.113 Inf   -0.7269   -0.2826
##  misaligned congruent   bottom different     0.75        -0.4800 0.113 Inf   -0.7016   -0.2585
##  aligned    incongruent bottom different     0.75         0.0124 0.112 Inf   -0.2081    0.2329
##  misaligned incongruent bottom different     0.75         0.0973 0.113 Inf   -0.1235    0.3180
## 
## Results are given on the probit (not the response) scale. 
## Confidence level used: 0.95

3.1.2.2 Estimated marginal means for d’

emm_E2_d <- contrast(emm_E2_resp, method = "pairwise", simple = "SameDifferent")
summary(emm_E2_d[1:16], infer = c(TRUE, FALSE), adjust = "none")
##  contrast         Alignment  Congruency  Cue    Probability estimate    SE  df asymp.LCL asymp.UCL
##  same - different aligned    congruent   top    0.25          1.6894 0.168 Inf     1.361     2.018
##  same - different misaligned congruent   top    0.25          1.4520 0.167 Inf     1.125     1.779
##  same - different aligned    incongruent top    0.25          0.0699 0.164 Inf    -0.251     0.391
##  same - different misaligned incongruent top    0.25          0.5105 0.164 Inf     0.189     0.832
##  same - different aligned    congruent   bottom 0.25          2.2200 0.156 Inf     1.915     2.525
##  same - different misaligned congruent   bottom 0.25          2.0372 0.155 Inf     1.734     2.340
##  same - different aligned    incongruent bottom 0.25          1.2221 0.153 Inf     0.922     1.522
##  same - different misaligned incongruent bottom 0.25          1.3292 0.153 Inf     1.029     1.629
##  same - different aligned    congruent   top    0.75          2.4755 0.156 Inf     2.170     2.781
##  same - different misaligned congruent   top    0.75          2.0582 0.154 Inf     1.756     2.361
##  same - different aligned    incongruent top    0.75          1.1263 0.152 Inf     0.828     1.425
##  same - different misaligned incongruent top    0.75          1.6718 0.154 Inf     1.371     1.973
##  same - different aligned    congruent   bottom 0.75          1.6550 0.169 Inf     1.325     1.985
##  same - different misaligned congruent   bottom 0.75          1.4365 0.167 Inf     1.110     1.763
##  same - different aligned    incongruent bottom 0.75          0.1366 0.164 Inf    -0.184     0.458
##  same - different misaligned incongruent bottom 0.75          0.0666 0.164 Inf    -0.254     0.388
## 
## Note: contrasts are still on the probit scale 
## Confidence level used: 0.95
# emmip(emm_E2_d, Congruency ~ Alignment | Cue + Probability, CIs = TRUE)
plot_E2_cf_d <- summary(emm_E2_d[1:16], infer = c(TRUE, FALSE), adjust = "sidak") %>% 
  as_tibble() %>% 
  ggplot(aes(y = estimate, x = Alignment, color = Congruency, group = Congruency)) +
  geom_point(position = position_dodge(width = 0.1), size = 2) +
  geom_line(aes(linetype = Congruency), position = position_dodge(width = 0.1),
            size = 0.8) +
  scale_linetype_manual(values=c("solid", "dashed"))+
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0, 
                alpha = .6, position = position_dodge(width = 0.1),
                show.legend = F) + 
  facet_grid(Probability ~Cue, switch = "x",
             labeller = labeller(Probability = c(`0.25` = "25% cueing top", `0.75` = "75% cueing top"))) +
  coord_cartesian(ylim = ylimit_cf_d) +  # set the limit for y axis c(0, 1100)
  labs(x = "Target half", y = expression("Sensitivity"~italic("d'")), fill = "Congruency") +  # set the names for main, x and y axises
  geom_text(label = c("***", "", "", "", "*", "", "", "", "***", "", "", "", "", "", "", ""), color = "red", size = 6, nudge_y = 0.4, nudge_x = 0.5) + # add starts to the significant columns
  theme_bw() +
  theme(
    text = element_text(size = 10),
    axis.title = element_text(size = 16), 
    axis.text = element_text(size = 14), # the size of the texts in plot
    # axis.text.x = element_text(angle = 45, vjust = 0.5),
    legend.title=element_text(size=15),
    legend.text=element_text(size=14),
    legend.position = "right",
    legend.key.width = unit(1.2, "cm"),
    plot.title = element_text(lineheight=.8, face="bold", size = 17),
    panel.border = element_blank(),
    panel.grid.minor = element_blank(),
    panel.grid.major = element_blank(),
    axis.line.x = element_line(colour = 'black', size=0.5, linetype='solid'),
    axis.line.y = element_line(colour = 'black', size=0.5, linetype='solid'),
    # remove the facet background color
    strip.text = element_text(face="bold", size=14, lineheight=5.0),
    strip.background = element_rect(fill="white", colour="white", size=1),
    strip.placement = "outside"
  ) 

# ggsave(filename = "E2_cf_d.pdf", plot_E2_cf_d, width = 8, height = 4.8)
plot_E2_cf_d

3.1.2.3 Composite effects

Composite face effects for top and bottom parts:

emm_E2_d_cf <- contrast(emm_E2_resp, interaction = "pairwise", by = c("Cue", "Probability"))
summary(emm_E2_d_cf[1:4], infer = TRUE)
##  Alignment_pairwise   Congruency_pairwise     SameDifferent_pairwise Cue    Probability estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  aligned - misaligned congruent - incongruent same - different       top    0.25           0.678 0.170 Inf    0.3457     1.010   4.000  0.0001
##  aligned - misaligned congruent - incongruent same - different       bottom 0.25           0.290 0.118 Inf    0.0584     0.521   2.455  0.0141
##  aligned - misaligned congruent - incongruent same - different       top    0.75           0.963 0.118 Inf    0.7311     1.194   8.147  <.0001
##  aligned - misaligned congruent - incongruent same - different       bottom 0.75           0.149 0.170 Inf   -0.1852     0.482   0.872  0.3830
## 
## Confidence level used: 0.95
emm_E2_d_con <- contrast(emm_E2_resp, interaction = "pairwise", by = c("Cue", "Probability", "Alignment"))
summary(emm_E2_d_con[seq(1,7,2)], infer = TRUE)
##  Congruency_pairwise     SameDifferent_pairwise Cue    Probability Alignment estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  congruent - incongruent same - different       top    0.25        aligned      1.620 0.201 Inf     1.226      2.01   8.063  <.0001
##  congruent - incongruent same - different       bottom 0.25        aligned      0.998 0.182 Inf     0.641      1.35   5.483  <.0001
##  congruent - incongruent same - different       top    0.75        aligned      1.349 0.182 Inf     0.993      1.71   7.423  <.0001
##  congruent - incongruent same - different       bottom 0.75        aligned      1.518 0.202 Inf     1.123      1.91   7.525  <.0001
## 
## Confidence level used: 0.95

3.1.2.4 Facilitation and interference

# Sensitivity d'
emm_E2_d_fi <- contrast(emm_E2_resp, interaction = "pairwise", by = c("Cue", "Congruency", "Probability"), adjust = "sidak")
summary(emm_E2_d_fi[1:8], infer=TRUE)
##  Alignment_pairwise   SameDifferent_pairwise Cue    Congruency  Probability estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  aligned - misaligned same - different       top    congruent   0.25           0.237 0.1211 Inf   -0.0928     0.568   1.961  0.3360
##  aligned - misaligned same - different       top    incongruent 0.25          -0.441 0.1116 Inf   -0.7449    -0.136  -3.948  0.0006
##  aligned - misaligned same - different       bottom congruent   0.25           0.183 0.0824 Inf   -0.0420     0.408   2.217  0.1940
##  aligned - misaligned same - different       bottom incongruent 0.25          -0.107 0.0748 Inf   -0.3112     0.097  -1.431  0.7340
##  aligned - misaligned same - different       top    congruent   0.75           0.417 0.0831 Inf    0.1908     0.644   5.024  <.0001
##  aligned - misaligned same - different       top    incongruent 0.75          -0.545 0.0742 Inf   -0.7478    -0.343  -7.350  <.0001
##  aligned - misaligned same - different       bottom congruent   0.75           0.219 0.1221 Inf   -0.1143     0.551   1.790  0.4567
##  aligned - misaligned same - different       bottom incongruent 0.75           0.070 0.1115 Inf   -0.2340     0.374   0.628  0.9976
## 
## Confidence level used: 0.95 
## Conf-level adjustment: sidak method for 8 estimates 
## P value adjustment: sidak method for 8 tests
# emmip(emm_E2_d_fi[1:8], ~ Probability | Cue + Congruency, CIs = TRUE, adjust = "sidak")
plot_E2_cffi_d <- summary(emm_E2_d_fi[1:8], infer=TRUE) %>% 
  as_tibble() %>% 
  ggplot(aes(y = estimate, x = Cue, color = Congruency)) +
  geom_point(size = 2) +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0, 
                alpha = .6) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  facet_grid(Probability ~ Congruency, switch = "x",
             labeller = labeller(Probability = c(`0.25` = "25% cueing top", `0.75` = "75% cueing top"))) +
  coord_cartesian(ylim = ylimit_cf_fi_d) +  # set the limit for y axis c(0, 1100)
  labs(x = "Congruency", y = expression(italic("d'")~"(aligned-misaligned)")) +  # set the names for main, x and y axises
  theme_bw() +
  theme(
    text = element_text(size = 10),
    axis.title = element_text(size = 16), 
    axis.text = element_text(size = 14), # the size of the texts in plot
    # axis.text.x = element_text(angle = 45, vjust = 0.5),
    legend.title=element_text(size=15),
    legend.text=element_text(size=14),
    legend.position = "none",
    legend.key.width = unit(1.2, "cm"),
    plot.title = element_text(lineheight=.8, face="bold", size = 17),
    panel.border = element_blank(),
    panel.grid.minor = element_blank(),
    panel.grid.major = element_blank(),
    axis.line.x = element_line(colour = 'black', size=0.5, linetype='solid'),
    axis.line.y = element_line(colour = 'black', size=0.5, linetype='solid'),
    # remove the facet background color
    strip.text = element_text(face="bold", size=14, lineheight=5.0),
    strip.background = element_rect(fill="white", colour="white", size=1),
    strip.placement = "outside"
  ) +
  NULL

# ggsave(filename = "E2_fi_d.pdf", plot_E2_cffi_d, width = 7, height = 4.55)
plot_E2_cffi_d

plot_E2_cf_d_ <- plot_E2_cf_d +
  guides(color = guide_legend(nrow = 1, title.position = "left"), 
         linetype = guide_legend(nrow = 1, title.position = "left")) +
  theme(legend.position = c(0.6, 0.5),
        legend.box = "horizontal") 

plot_E2_d <- ggarrange(plot_E2_cf_d_, plot_E2_cffi_d, 
                       labels = c("A", "B"),
                       font.label = (list(size = 20)),
                       widths = c(1.5, 1),
                       nrow = 1)

# ggsave(filename = "E2_d.pdf", plot_E2_d, width = 10, height = 7)
plot_E2_d

3.1.2.5 Comparisons between facilitation and interference

contrast(emm_E2_d_fi, method = list("faci-inte"=c(1, 1)), by = c("Cue", "Probability"))[1:4] %>% 
  summary(infer = TRUE)
##  contrast  Cue    Probability estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  faci-inte top    0.25         -0.2032 0.160 Inf   -0.5161     0.110  -1.272  0.2032
##  faci-inte bottom 0.25          0.0757 0.104 Inf   -0.1284     0.280   0.727  0.4672
##  faci-inte top    0.75         -0.1281 0.104 Inf   -0.3323     0.076  -1.230  0.2186
##  faci-inte bottom 0.75          0.2885 0.160 Inf   -0.0254     0.602   1.801  0.0716
## 
## Confidence level used: 0.95

3.2 Response times

df_lmm_E2_rt <- df_lmm_E2 %>% 
  filter(isCorrect == 1)

# save(df_lmm_E2_rt, file = file.path("data", "df_lmm_E2_rt.RData"))

3.2.1 Fitting the generalized mixed models

with log-transformation. #### The maximal model

# file_E2_rt_max <- file.path(folder_lmm, "E2_rt_lmm_max.RData")
# 
# # fit the max model
# if (!file.exists(file_E2_rt_max)) {
#   glmm_E2_rt_max <- glmer(
#     log(RT) ~ Cue * Congruency * Alignment * Probability + 
#       (Cue * Congruency * Alignment * Probability | Participant), 
#     family = lognormal(),
#     data = df_lmm_rt,
#     control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
#                            optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
#   )
# 
#   save(glmm_E2_rt_max, file = file_E2_rt_max)
# } else {
#   load(file_E2_rt_max)
# }
# 
# print(summary(glmm_E2_rt_max), corr = FALSE)

3.2.1.1 The zero-correlation-parameter model

file_E2_rt_zcp <- file.path(folder_lmm, "E2_rt_lmm_zcp.RData")

# fit the zcp1 model
if (!file.exists(file_E2_rt_zcp)) {
  glmm_E2_rt_zcp <- lmer(
    log(RT) ~ Cue * Congruency * Alignment * Probability +  
      (Cue_C + Con_C + Ali_C + 
         Cue_Con + Cue_Ali + Con_Ali + 
         Cue_Con_Ali +
         Pro_C +
         Cue_Pro + Con_Pro + Ali_Pro + 
         Cue_Con_Pro + Cue_Ali_Pro + Con_Ali_Pro + 
         Cue_Con_Ali_Pro || Participant),
    data = df_lmm_E2_rt,
    control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                          optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E2_rt_zcp, file = file_E2_rt_zcp)
} else {
  load(file_E2_rt_zcp)
}

print(summary(glmm_E2_rt_zcp), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment * Probability + (Cue_C +      Con_C + Ali_C + Cue_Con + Cue_Ali + Con_Ali + Cue_Con_Ali +      Pro_C + Cue_Pro + Con_Pro + Ali_Pro + Cue_Con_Pro + Cue_Ali_Pro +      Con_Ali_Pro + Cue_Con_Ali_Pro || Participant)
##    Data: df_lmm_E2_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
## REML criterion at convergence: 20092.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.2443 -0.5901 -0.1322  0.4296 10.6198 
## 
## Random effects:
##  Groups         Name            Variance  Std.Dev. 
##  Participant    (Intercept)     4.570e-02 2.138e-01
##  Participant.1  Cue_C           4.814e-03 6.938e-02
##  Participant.2  Con_C           3.427e-04 1.851e-02
##  Participant.3  Ali_C           5.044e-04 2.246e-02
##  Participant.4  Cue_Con         6.945e-04 2.635e-02
##  Participant.5  Cue_Ali         0.000e+00 0.000e+00
##  Participant.6  Con_Ali         5.039e-04 2.245e-02
##  Participant.7  Cue_Con_Ali     2.215e-04 1.488e-02
##  Participant.8  Pro_C           4.729e-02 2.175e-01
##  Participant.9  Cue_Pro         7.550e-02 2.748e-01
##  Participant.10 Con_Pro         5.963e-10 2.442e-05
##  Participant.11 Ali_Pro         0.000e+00 0.000e+00
##  Participant.12 Cue_Con_Pro     4.505e-09 6.712e-05
##  Participant.13 Cue_Ali_Pro     4.565e-03 6.756e-02
##  Participant.14 Con_Ali_Pro     0.000e+00 0.000e+00
##  Participant.15 Cue_Con_Ali_Pro 2.012e-07 4.485e-04
##  Residual                       1.110e-01 3.331e-01
## Number of obs: 30371, groups:  Participant, 32
## 
## Fixed effects:
##                                                                      Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                                         6.690e+00  3.888e-02  3.443e+01 172.052  < 2e-16 ***
## Cuebottom                                                          -3.155e-03  1.519e-02  5.423e+01  -0.208 0.836273    
## Congruencyincongruent                                               6.257e-02  1.055e-02  2.057e+02   5.928 1.28e-08 ***
## Alignmentmisaligned                                                 4.145e-02  9.755e-03  1.622e+02   4.249 3.61e-05 ***
## Probability2-1                                                     -1.247e-01  4.716e-02  5.844e+01  -2.645 0.010470 *  
## Cuebottom:Congruencyincongruent                                     1.630e-02  1.434e-02  1.077e+02   1.136 0.258321    
## Cuebottom:Alignmentmisaligned                                       5.224e-03  1.236e-02  1.623e+02   0.423 0.672997    
## Congruencyincongruent:Alignmentmisaligned                          -4.881e-02  1.387e-02  1.121e+02  -3.520 0.000625 ***
## Cuebottom:Probability2-1                                            2.721e-01  5.190e-02  3.737e+01   5.244 6.46e-06 ***
## Congruencyincongruent:Probability2-1                               -4.404e-02  1.904e-02  2.999e+04  -2.312 0.020776 *  
## Alignmentmisaligned:Probability2-1                                 -3.556e-02  1.832e-02  2.877e+02  -1.941 0.053234 .  
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                -1.675e-03  1.906e-02  5.759e+01  -0.088 0.930264    
## Cuebottom:Congruencyincongruent:Probability2-1                      7.721e-02  2.697e-02  2.933e+04   2.863 0.004201 ** 
## Cuebottom:Alignmentmisaligned:Probability2-1                        8.364e-02  2.734e-02  8.972e+01   3.059 0.002927 ** 
## Congruencyincongruent:Alignmentmisaligned:Probability2-1            4.539e-02  2.643e-02  2.927e+04   1.718 0.085855 .  
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -5.483e-02  3.773e-02  2.709e+04  -1.453 0.146240    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1 
## boundary (singular) fit: see ?isSingular

3.2.1.2 The reduced model

summary(rePCA(glmm_E2_rt_zcp))
## $Participant
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]    [,6]    [,7]    [,8]    [,9]   [,10]    [,11]     [,12]    [,13] [,14] [,15] [,16]
## Standard deviation     0.8248 0.6528 0.6418 0.20828 0.20281 0.07911 0.06742 0.06739 0.05557 0.04468 0.001346 0.0002015 7.33e-05     0     0     0
## Proportion of Variance 0.4191 0.2625 0.2537 0.02673 0.02534 0.00386 0.00280 0.00280 0.00190 0.00123 0.000000 0.0000000 0.00e+00     0     0     0
## Cumulative Proportion  0.4191 0.6816 0.9354 0.96207 0.98741 0.99127 0.99407 0.99687 0.99877 1.00000 1.000000 1.0000000 1.00e+00     1     1     1

Cue_Ali, Ali_Pro, Con_Ali_Pro, Con_Pro, Cue_Con_Pro, and Cue_Con_Ali_Pro were removed from extended model (glmm_E2_rt_zcp) due to that the variance it explained was smaller than 0.1%, making glmm_E2_rt_rdc.

file_E2_rt_rdc <- file.path(folder_lmm, "E2_rt_lmm_rdc.RData")

# fit the rdc1 model
if (!file.exists(file_E2_rt_rdc)) {
  glmm_E2_rt_rdc <- lmer(
    log(RT) ~ Cue * Congruency * Alignment * Probability +  
      (Cue_C + Con_C + Ali_C + 
         Cue_Con + Con_Ali + # Cue_Ali + 
         Cue_Con_Ali +
         Pro_C +
         Cue_Pro +  # Ali_Pro + Con_Pro +
         Cue_Ali_Pro  # Con_Ali_Pro + Cue_Con_Pro + 
          || Participant), # Cue_Con_Ali_Pro
    data = df_lmm_E2_rt,
    control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                          optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E2_rt_rdc, file = file_E2_rt_rdc)
} else {
  load(file_E2_rt_rdc)
}

print(summary(glmm_E2_rt_rdc), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment * Probability + (Cue_C +      Con_C + Ali_C + Cue_Con + Con_Ali + Cue_Con_Ali + Pro_C +      Cue_Pro + Cue_Ali_Pro || Participant)
##    Data: df_lmm_E2_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
## REML criterion at convergence: 20092.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.2444 -0.5901 -0.1322  0.4295 10.6198 
## 
## Random effects:
##  Groups        Name        Variance  Std.Dev.
##  Participant   (Intercept) 0.0457251 0.21383 
##  Participant.1 Cue_C       0.0048160 0.06940 
##  Participant.2 Con_C       0.0003423 0.01850 
##  Participant.3 Ali_C       0.0005045 0.02246 
##  Participant.4 Cue_Con     0.0006969 0.02640 
##  Participant.5 Con_Ali     0.0005035 0.02244 
##  Participant.6 Cue_Con_Ali 0.0002217 0.01489 
##  Participant.7 Pro_C       0.0473011 0.21749 
##  Participant.8 Cue_Pro     0.0754976 0.27477 
##  Participant.9 Cue_Ali_Pro 0.0045724 0.06762 
##  Residual                  0.1109745 0.33313 
## Number of obs: 30371, groups:  Participant, 32
## 
## Fixed effects:
##                                                                      Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                                         6.690e+00  3.889e-02  3.441e+01 172.015  < 2e-16 ***
## Cuebottom                                                          -3.155e-03  1.519e-02  5.420e+01  -0.208 0.836278    
## Congruencyincongruent                                               6.257e-02  1.056e-02  2.057e+02   5.928 1.28e-08 ***
## Alignmentmisaligned                                                 4.145e-02  9.755e-03  1.622e+02   4.249 3.61e-05 ***
## Probability2-1                                                     -1.247e-01  4.716e-02  5.842e+01  -2.645 0.010478 *  
## Cuebottom:Congruencyincongruent                                     1.630e-02  1.434e-02  1.077e+02   1.136 0.258371    
## Cuebottom:Alignmentmisaligned                                       5.224e-03  1.236e-02  1.623e+02   0.423 0.673007    
## Congruencyincongruent:Alignmentmisaligned                          -4.881e-02  1.387e-02  1.121e+02  -3.520 0.000624 ***
## Cuebottom:Probability2-1                                            2.721e-01  5.190e-02  3.737e+01   5.244 6.46e-06 ***
## Congruencyincongruent:Probability2-1                               -4.404e-02  1.904e-02  3.018e+04  -2.312 0.020775 *  
## Alignmentmisaligned:Probability2-1                                 -3.556e-02  1.832e-02  2.874e+02  -1.941 0.053255 .  
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                -1.675e-03  1.906e-02  5.760e+01  -0.088 0.930246    
## Cuebottom:Congruencyincongruent:Probability2-1                      7.721e-02  2.697e-02  3.008e+04   2.863 0.004201 ** 
## Cuebottom:Alignmentmisaligned:Probability2-1                        8.364e-02  2.735e-02  8.966e+01   3.059 0.002932 ** 
## Congruencyincongruent:Alignmentmisaligned:Probability2-1            4.539e-02  2.643e-02  2.998e+04   1.718 0.085863 .  
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -5.483e-02  3.773e-02  2.956e+04  -1.453 0.146248    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

3.2.1.3 The extended model

file_E2_rt_etd <- file.path(folder_lmm, "E2_rt_lmm_etd.RData")

# fit the etd model
if (!file.exists(file_E2_rt_etd)) {
  glmm_E2_rt_etd <- lmer(
    log(RT) ~ Cue * Congruency * Alignment * Probability +  
      (Cue_C + Con_C + Ali_C + 
         Cue_Con + Con_Ali + # Cue_Ali + 
         Cue_Con_Ali +
         Pro_C +
         Cue_Pro +  # Ali_Pro + Con_Pro +
         Cue_Ali_Pro  # Con_Ali_Pro + Cue_Con_Pro + 
          | Participant), # Cue_Con_Ali_Pro
    data = df_lmm_E2_rt,
    control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                          optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E2_rt_etd, file = file_E2_rt_etd)
} else {
  load(file_E2_rt_etd)
}

print(summary(glmm_E2_rt_etd), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment * Probability + (Cue_C +      Con_C + Ali_C + Cue_Con + Con_Ali + Cue_Con_Ali + Pro_C +      Cue_Pro + Cue_Ali_Pro | Participant)
##    Data: df_lmm_E2_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
## REML criterion at convergence: 20010.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.2586 -0.5908 -0.1304  0.4305 10.6496 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev. Corr                                                 
##  Participant (Intercept) 0.0464276 0.21547                                                       
##              Cue_C       0.0049674 0.07048  -0.20                                                
##              Con_C       0.0004322 0.02079   0.33 -0.46                                          
##              Ali_C       0.0007474 0.02734   0.17  0.16  0.06                                    
##              Cue_Con     0.0010951 0.03309   0.01  0.38 -0.32 -0.26                              
##              Con_Ali     0.0012791 0.03576  -0.09  0.02 -0.48 -0.08  0.44                        
##              Cue_Con_Ali 0.0039599 0.06293  -0.63  0.07 -0.10 -0.55 -0.12  0.29                  
##              Pro_C       0.0479580 0.21899   0.09  0.30 -0.72  0.07  0.42  0.21 -0.48            
##              Cue_Pro     0.0763459 0.27631   0.53 -0.24  0.20 -0.38  0.02 -0.58 -0.47  0.23      
##              Cue_Ali_Pro 0.0089737 0.09473  -0.15  0.30 -0.16  0.36 -0.35  0.29  0.25  0.06 -0.61
##  Residual                0.1107688 0.33282                                                       
## Number of obs: 30371, groups:  Participant, 32
## 
## Fixed effects:
##                                                                      Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                                         6.690e+00  4.013e-02  3.103e+01 166.699  < 2e-16 ***
## Cuebottom                                                          -2.038e-03  1.501e-02  4.127e+01  -0.136  0.89266    
## Congruencyincongruent                                               6.184e-02  1.232e-02  5.877e+01   5.021 5.08e-06 ***
## Alignmentmisaligned                                                 4.106e-02  9.936e-03  8.377e+01   4.132 8.48e-05 ***
## Probability2-1                                                     -1.244e-01  4.429e-02  3.361e+01  -2.810  0.00821 ** 
## Cuebottom:Congruencyincongruent                                     1.510e-02  1.596e-02  6.841e+01   0.946  0.34754    
## Cuebottom:Alignmentmisaligned                                       3.857e-03  1.348e-02  1.917e+02   0.286  0.77504    
## Congruencyincongruent:Alignmentmisaligned                          -4.682e-02  1.499e-02  1.019e+02  -3.123  0.00233 ** 
## Cuebottom:Probability2-1                                            2.716e-01  5.702e-02  3.326e+01   4.764 3.63e-05 ***
## Congruencyincongruent:Probability2-1                               -4.329e-02  1.904e-02  2.979e+04  -2.274  0.02300 *  
## Alignmentmisaligned:Probability2-1                                 -3.545e-02  1.922e-02  2.027e+02  -1.844  0.06661 .  
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                -1.385e-04  2.186e-02  8.332e+01  -0.006  0.99496    
## Cuebottom:Congruencyincongruent:Probability2-1                      7.713e-02  2.695e-02  2.985e+04   2.862  0.00422 ** 
## Cuebottom:Alignmentmisaligned:Probability2-1                        8.401e-02  2.974e-02  7.293e+01   2.825  0.00610 ** 
## Congruencyincongruent:Alignmentmisaligned:Probability2-1            4.266e-02  2.640e-02  2.988e+04   1.616  0.10612    
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -5.287e-02  3.767e-02  2.964e+04  -1.404  0.16046    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1 
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E2_rt_etd))
## $Participant
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]    [,6]    [,7]    [,8]     [,9]     [,10]
## Standard deviation     0.9715 0.6509 0.5085 0.21791 0.18936 0.14860 0.05757 0.01157 0.001596 1.485e-05
## Proportion of Variance 0.5440 0.2442 0.1490 0.02737 0.02067 0.01273 0.00191 0.00008 0.000000 0.000e+00
## Cumulative Proportion  0.5440 0.7882 0.9373 0.96462 0.98528 0.99801 0.99992 1.00000 1.000000 1.000e+00

Con_C, Ali_C, Cue_C, and Cue_Ali_Pro were removed from extended model.

file_E2_rt_etd1 <- file.path(folder_lmm, "E2_rt_lmm_etd1.RData")

# fit the etd1 model
if (!file.exists(file_E2_rt_etd1)) {
  glmm_E2_rt_etd1 <- lmer(
    log(RT) ~ Cue * Congruency * Alignment * Probability +  
      ( # Cue_C + Con_C + Ali_C + 
         Cue_Con + Con_Ali + # Cue_Ali + 
         Cue_Con_Ali +
         Pro_C +
         Cue_Pro  # Ali_Pro + Con_Pro +
           # Con_Ali_Pro + Cue_Con_Pro + Cue_Ali_Pro
          | Participant), # Cue_Con_Ali_Pro
    data = df_lmm_E2_rt,
    control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                          optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E2_rt_etd1, file = file_E2_rt_etd1)
} else {
  load(file_E2_rt_etd1)
}

print(summary(glmm_E2_rt_etd1), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment * Probability + (Cue_Con +      Con_Ali + Cue_Con_Ali + Pro_C + Cue_Pro | Participant)
##    Data: df_lmm_E2_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
## REML criterion at convergence: 20233.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.1945 -0.5956 -0.1291  0.4333 10.5434 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev. Corr                         
##  Participant (Intercept) 0.0460165 0.21451                               
##              Cue_Con     0.0006146 0.02479   0.07                        
##              Con_Ali     0.0007873 0.02806  -0.14  0.65                  
##              Cue_Con_Ali 0.0023819 0.04880  -0.81 -0.09  0.08            
##              Pro_C       0.0444586 0.21085   0.15  0.51  0.29 -0.64      
##              Cue_Pro     0.0761836 0.27601   0.53  0.10 -0.64 -0.54  0.31
##  Residual                0.1120021 0.33467                               
## Number of obs: 30371, groups:  Participant, 32
## 
## Fixed effects:
##                                                                      Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                                         6.688e+00  3.923e-02  3.182e+01 170.466  < 2e-16 ***
## Cuebottom                                                          -1.585e-03  9.221e-03  2.488e+02  -0.172 0.863640    
## Congruencyincongruent                                               6.336e-02  1.065e-02  1.165e+02   5.949 2.90e-08 ***
## Alignmentmisaligned                                                 4.267e-02  9.245e-03  3.125e+02   4.615 5.74e-06 ***
## Probability2-1                                                     -1.217e-01  3.961e-02  3.589e+01  -3.074 0.004026 ** 
## Cuebottom:Congruencyincongruent                                     1.544e-02  1.492e-02  1.070e+02   1.035 0.302881    
## Cuebottom:Alignmentmisaligned                                       4.047e-03  1.307e-02  3.146e+02   0.310 0.756947    
## Congruencyincongruent:Alignmentmisaligned                          -5.010e-02  1.467e-02  1.245e+02  -3.414 0.000865 ***
## Cuebottom:Probability2-1                                            2.693e-01  5.178e-02  3.643e+01   5.202 7.85e-06 ***
## Congruencyincongruent:Probability2-1                               -4.602e-02  1.906e-02  3.022e+04  -2.415 0.015755 *  
## Alignmentmisaligned:Probability2-1                                 -3.711e-02  1.738e-02  3.024e+04  -2.135 0.032752 *  
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                -1.388e-05  2.078e-02  1.263e+02  -0.001 0.999468    
## Cuebottom:Congruencyincongruent:Probability2-1                      8.156e-02  2.700e-02  3.026e+04   3.021 0.002523 ** 
## Cuebottom:Alignmentmisaligned:Probability2-1                        8.534e-02  2.466e-02  3.024e+04   3.460 0.000540 ***
## Congruencyincongruent:Alignmentmisaligned:Probability2-1            4.671e-02  2.650e-02  3.023e+04   1.763 0.077914 .  
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -5.904e-02  3.781e-02  3.018e+04  -1.562 0.118375    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_E2_rt_etd1))
## $Participant
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]      [,5]      [,6]
## Standard deviation     0.9621 0.5960 0.4831 0.08617 6.331e-06 4.056e-06
## Proportion of Variance 0.6083 0.2334 0.1534 0.00488 0.000e+00 0.000e+00
## Cumulative Proportion  0.6083 0.8417 0.9951 1.00000 1.000e+00 1.000e+00

Cue_Con, Con_Ali, and Cue_Con_Ali were removed from extended model.

file_E2_rt_etd2 <- file.path(folder_lmm, "E2_rt_lmm_etd2.RData")

# fit the etd2 model
if (!file.exists(file_E2_rt_etd2)) {
  glmm_E2_rt_etd2 <- lmer(
    log(RT) ~ Cue * Congruency * Alignment * Probability +  
      ( # Cue_C + Con_C + Ali_C + 
         # Cue_Ali + Con_Ali + Cue_Con + 
         # Cue_Con_Ali +
         Pro_C +
         Cue_Pro  # Ali_Pro + Con_Pro +
           # Con_Ali_Pro + Cue_Con_Pro + Cue_Ali_Pro
          | Participant), # Cue_Con_Ali_Pro
    data = df_lmm_E2_rt,
    control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                          optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_E2_rt_etd2, file = file_E2_rt_etd2)
} else {
  load(file_E2_rt_etd2)
}

print(summary(glmm_E2_rt_etd2), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment * Probability + (Pro_C +      Cue_Pro | Participant)
##    Data: df_lmm_E2_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
## REML criterion at convergence: 20255.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.1850 -0.5961 -0.1295  0.4324 10.5556 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev. Corr     
##  Participant (Intercept) 0.04609  0.2147            
##              Pro_C       0.04458  0.2111   0.15     
##              Cue_Pro     0.07626  0.2761   0.53 0.31
##  Residual                0.11212  0.3348            
## Number of obs: 30371, groups:  Participant, 32
## 
## Fixed effects:
##                                                                      Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                                         6.688e+00  3.844e-02  3.234e+01 173.996  < 2e-16 ***
## Cuebottom                                                          -1.724e-03  8.648e-03  3.027e+04  -0.199 0.842035    
## Congruencyincongruent                                               6.324e-02  9.525e-03  3.028e+04   6.639 3.20e-11 ***
## Alignmentmisaligned                                                 4.252e-02  8.694e-03  3.026e+04   4.891 1.01e-06 ***
## Probability2-1                                                     -1.222e-01  3.967e-02  3.588e+01  -3.080 0.003958 ** 
## Cuebottom:Congruencyincongruent                                     1.640e-02  1.347e-02  3.027e+04   1.218 0.223357    
## Cuebottom:Alignmentmisaligned                                       4.951e-03  1.234e-02  3.026e+04   0.401 0.688210    
## Congruencyincongruent:Alignmentmisaligned                          -5.016e-02  1.325e-02  3.027e+04  -3.785 0.000154 ***
## Cuebottom:Probability2-1                                            2.705e-01  5.180e-02  3.644e+01   5.222 7.38e-06 ***
## Congruencyincongruent:Probability2-1                               -4.541e-02  1.906e-02  3.028e+04  -2.382 0.017220 *  
## Alignmentmisaligned:Probability2-1                                 -3.658e-02  1.739e-02  3.026e+04  -2.104 0.035388 *  
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                -2.584e-03  1.891e-02  3.026e+04  -0.137 0.891276    
## Cuebottom:Congruencyincongruent:Probability2-1                      7.937e-02  2.701e-02  3.028e+04   2.939 0.003300 ** 
## Cuebottom:Alignmentmisaligned:Probability2-1                        8.363e-02  2.467e-02  3.026e+04   3.389 0.000702 ***
## Congruencyincongruent:Alignmentmisaligned:Probability2-1            4.645e-02  2.651e-02  3.027e+04   1.752 0.079722 .  
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -5.607e-02  3.782e-02  3.027e+04  -1.483 0.138190    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

3.2.1.4 The optimal model

# compare the extended and reduced model
anova(glmm_E2_rt_etd2, glmm_E2_rt_rdc, refit = FALSE)
## Data: df_lmm_E2_rt
## Models:
## glmm_E2_rt_etd2: log(RT) ~ Cue * Congruency * Alignment * Probability + (Pro_C + 
## glmm_E2_rt_etd2:     Cue_Pro | Participant)
## glmm_E2_rt_rdc: log(RT) ~ Cue * Congruency * Alignment * Probability + (Cue_C + 
## glmm_E2_rt_rdc:     Con_C + Ali_C + Cue_Con + Con_Ali + Cue_Con_Ali + Pro_C + 
## glmm_E2_rt_rdc:     Cue_Pro + Cue_Ali_Pro || Participant)
##                 npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)    
## glmm_E2_rt_etd2   23 20301 20493 -10128    20255                         
## glmm_E2_rt_rdc    27 20146 20371 -10046    20092 162.98  4  < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

According to BIC, the reduced model (glmm_E2_rt_rdc) explained the data better than the extended model (glmm_E2_rt_etd1) and, therefore, the reduced model is used as the optimal model.

glmm_E2_rt_opt <- glmm_E2_rt_rdc

print(summary(glmm_E2_rt_opt), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment * Probability + (Cue_C +      Con_C + Ali_C + Cue_Con + Con_Ali + Cue_Con_Ali + Pro_C +      Cue_Pro + Cue_Ali_Pro || Participant)
##    Data: df_lmm_E2_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
## REML criterion at convergence: 20092.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.2444 -0.5901 -0.1322  0.4295 10.6198 
## 
## Random effects:
##  Groups        Name        Variance  Std.Dev.
##  Participant   (Intercept) 0.0457251 0.21383 
##  Participant.1 Cue_C       0.0048160 0.06940 
##  Participant.2 Con_C       0.0003423 0.01850 
##  Participant.3 Ali_C       0.0005045 0.02246 
##  Participant.4 Cue_Con     0.0006969 0.02640 
##  Participant.5 Con_Ali     0.0005035 0.02244 
##  Participant.6 Cue_Con_Ali 0.0002217 0.01489 
##  Participant.7 Pro_C       0.0473011 0.21749 
##  Participant.8 Cue_Pro     0.0754976 0.27477 
##  Participant.9 Cue_Ali_Pro 0.0045724 0.06762 
##  Residual                  0.1109745 0.33313 
## Number of obs: 30371, groups:  Participant, 32
## 
## Fixed effects:
##                                                                      Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                                                         6.690e+00  3.889e-02  3.441e+01 172.015  < 2e-16 ***
## Cuebottom                                                          -3.155e-03  1.519e-02  5.420e+01  -0.208 0.836278    
## Congruencyincongruent                                               6.257e-02  1.056e-02  2.057e+02   5.928 1.28e-08 ***
## Alignmentmisaligned                                                 4.145e-02  9.755e-03  1.622e+02   4.249 3.61e-05 ***
## Probability2-1                                                     -1.247e-01  4.716e-02  5.842e+01  -2.645 0.010478 *  
## Cuebottom:Congruencyincongruent                                     1.630e-02  1.434e-02  1.077e+02   1.136 0.258371    
## Cuebottom:Alignmentmisaligned                                       5.224e-03  1.236e-02  1.623e+02   0.423 0.673007    
## Congruencyincongruent:Alignmentmisaligned                          -4.881e-02  1.387e-02  1.121e+02  -3.520 0.000624 ***
## Cuebottom:Probability2-1                                            2.721e-01  5.190e-02  3.737e+01   5.244 6.46e-06 ***
## Congruencyincongruent:Probability2-1                               -4.404e-02  1.904e-02  3.018e+04  -2.312 0.020775 *  
## Alignmentmisaligned:Probability2-1                                 -3.556e-02  1.832e-02  2.874e+02  -1.941 0.053255 .  
## Cuebottom:Congruencyincongruent:Alignmentmisaligned                -1.675e-03  1.906e-02  5.760e+01  -0.088 0.930246    
## Cuebottom:Congruencyincongruent:Probability2-1                      7.721e-02  2.697e-02  3.008e+04   2.863 0.004201 ** 
## Cuebottom:Alignmentmisaligned:Probability2-1                        8.364e-02  2.735e-02  8.966e+01   3.059 0.002932 ** 
## Congruencyincongruent:Alignmentmisaligned:Probability2-1            4.539e-02  2.643e-02  2.998e+04   1.718 0.085863 .  
## Cuebottom:Congruencyincongruent:Alignmentmisaligned:Probability2-1 -5.483e-02  3.773e-02  2.956e+04  -1.453 0.146248    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

3.2.2 Estimated marginal means

3.2.2.1 Estimated marginal means for RT

file_E2_rt_emm <- file.path(folder_lmm, "E2_rt_emm.RData") 
if (!file.exists(file_E2_rt_emm)) {
  emm_E2_rt <- emmeans(glmm_E2_rt_opt, ~ Cue + Congruency + Alignment + Probability)
} else {
  load(file_E2_rt_emm)
}

summary(emm_E2_rt, type = "response") # equivalent to regrid(emm_rt)
##  Cue    Congruency  Alignment  Probability response   SE  df asymp.LCL asymp.UCL
##  top    congruent   aligned    0.25             856 39.3 Inf       782       936
##  bottom congruent   aligned    0.25             745 33.6 Inf       682       813
##  top    incongruent aligned    0.25             931 43.4 Inf       850      1020
##  bottom incongruent aligned    0.25             793 35.8 Inf       725       866
##  top    congruent   misaligned 0.25             908 41.7 Inf       830       994
##  bottom congruent   misaligned 0.25             762 34.3 Inf       697       832
##  top    incongruent misaligned 0.25             920 42.6 Inf       840      1007
##  bottom incongruent misaligned 0.25             774 34.9 Inf       709       846
##  top    congruent   aligned    0.75             756 34.0 Inf       692       825
##  bottom congruent   aligned    0.75             863 39.6 Inf       789       944
##  top    incongruent aligned    0.75             787 35.5 Inf       720       860
##  bottom incongruent aligned    0.75             949 44.2 Inf       867      1040
##  top    congruent   misaligned 0.75             774 34.9 Inf       708       845
##  bottom congruent   misaligned 0.75             926 42.6 Inf       846      1013
##  top    incongruent misaligned 0.75             785 35.4 Inf       718       857
##  bottom incongruent misaligned 0.75             964 44.9 Inf       880      1056
## 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95 
## Intervals are back-transformed from the log scale
# emmip(regrid(emm_E2_rt), Congruency ~ Alignment | Cue + Probability, CIs = TRUE)
plot_E2_cf_rt <- summary(emm_E2_rt, type = "response") %>% 
  as_tibble() %>% 
  ggplot(aes(y = response, x = Alignment, color = Congruency, group = Congruency)) +
  geom_point(position = position_dodge(width = 0.1), size = 2) +
  geom_line(aes(linetype = Congruency), position = position_dodge(width = 0.1),
            size = 0.8) +
  scale_linetype_manual(values=c("solid", "dashed"))+
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0, 
                alpha = .6, position = position_dodge(width = 0.1),
                show.legend = F) + 
  facet_grid(Probability ~Cue, switch = "x",
             labeller = labeller(Probability = c(`0.25` = "25% cueing top", `0.75` = "75% cueing top"))) +
  coord_cartesian(ylim = ylimit_cf_rt) +  # set the limit for y axis c(0, 1100)
  labs(x = "Target half", y = "Correct response times (ms)", fill = "Congruency") +  # set the names for main, x and y axises
  geom_text(label = c("", "", "**", "***", "", "", "", "", "", "", "*", "*", "", "", "", ""), color = "red", size = 6, nudge_y = 50, nudge_x = 0.5) + # add starts to the significant columns
  theme_bw() +
  theme(
    text = element_text(size = 10),
    axis.title = element_text(size = 16), 
    axis.text = element_text(size = 14), # the size of the texts in plot
    # axis.text.x = element_text(angle = 45, vjust = 0.5),
    legend.title=element_text(size=15),
    legend.text=element_text(size=14),
    legend.position = "right",
    legend.key.width = unit(1.2, "cm"),
    plot.title = element_text(lineheight=.8, face="bold", size = 17),
    panel.border = element_blank(),
    panel.grid.minor = element_blank(),
    panel.grid.major = element_blank(),
    axis.line.x = element_line(colour = 'black', size=0.5, linetype='solid'),
    axis.line.y = element_line(colour = 'black', size=0.5, linetype='solid'),
    # remove the facet background color
    strip.text = element_text(face="bold", size=14, lineheight=5.0),
    strip.background = element_rect(fill="white", colour="white", size=1),
    strip.placement = "outside"
  ) 

# ggsave(filename = "E2_cf_rt.pdf", plot_E2_cf_rt, width = 8, height = 4.8)
plot_E2_cf_rt

3.2.2.2 Composite effects

Composite face effects for top and bottom parts:

emm_E2_rt_cf <- contrast(regrid(emm_E2_rt), interaction = "pairwise", by = c("Cue", "Probability"), infer = TRUE)
emm_E2_rt_cf[1:4]
##  Congruency_pairwise     Alignment_pairwise   Cue    Probability estimate   SE  df asymp.LCL asymp.UCL z.ratio p.value
##  congruent - incongruent aligned - misaligned top    0.25           -63.6 21.8 Inf    -106.4   -20.823  -2.914  0.0036
##  congruent - incongruent aligned - misaligned bottom 0.25           -35.2 10.2 Inf     -55.1   -15.210  -3.453  0.0006
##  congruent - incongruent aligned - misaligned top    0.75           -20.0 10.0 Inf     -39.7    -0.332  -1.993  0.0463
##  congruent - incongruent aligned - misaligned bottom 0.75           -48.4 22.7 Inf     -92.9    -3.834  -2.129  0.0333
## 
## Confidence level used: 0.95
emm_E2_rt_con <- contrast(regrid(emm_E2_rt), interaction = "pairwise", by = c("Cue", "Probability", "Alignment"))
summary(emm_E2_rt_con[c(1,2,5,6)], infer = TRUE)
##  Congruency_pairwise     Cue    Probability Alignment estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  congruent - incongruent top    0.25        aligned      -75.5 16.18 Inf    -107.2     -43.8  -4.670  <.0001
##  congruent - incongruent bottom 0.25        aligned      -47.9  7.93 Inf     -63.4     -32.3  -6.032  <.0001
##  congruent - incongruent top    0.75        aligned      -31.3  7.71 Inf     -46.4     -16.2  -4.056  <.0001
##  congruent - incongruent bottom 0.75        aligned      -86.4 16.50 Inf    -118.8     -54.1  -5.239  <.0001
## 
## Confidence level used: 0.95

3.2.2.3 Facilitation and interference

emm_E2_rt_fi <- contrast(regrid(emm_E2_rt), "pairwise", by = c("Cue", "Congruency", "Probability"), infer=TRUE, adjust = "sidak")
emm_E2_rt_fi[1:8]
##  contrast             Cue    Congruency  Probability estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  aligned - misaligned top    congruent   0.25          -52.23 14.43 Inf    -91.56    -12.89  -3.620  0.0023
##  aligned - misaligned bottom congruent   0.25          -17.05  7.57 Inf    -37.69      3.59  -2.252  0.1787
##  aligned - misaligned top    incongruent 0.25           11.36 17.29 Inf    -35.77     58.50   0.657  0.9967
##  aligned - misaligned bottom incongruent 0.25           18.12  8.33 Inf     -4.58     40.83   2.177  0.2130
##  aligned - misaligned top    congruent   0.75          -18.10  7.62 Inf    -38.87      2.67  -2.376  0.1318
##  aligned - misaligned bottom congruent   0.75          -63.23 14.78 Inf   -103.54    -22.92  -4.278  0.0002
##  aligned - misaligned top    incongruent 0.75            1.92  8.20 Inf    -20.44     24.28   0.234  1.0000
##  aligned - misaligned bottom incongruent 0.75          -14.84 18.37 Inf    -64.93     35.24  -0.808  0.9870
## 
## Confidence level used: 0.95 
## Conf-level adjustment: sidak method for 8 estimates 
## P value adjustment: sidak method for 8 tests
# emmip(emm_E2_rt_fi[1:8], ~ Probability | Cue + Congruency, CIs = TRUE, adjust = "sidak") +
#   geom_hline(yintercept = 0, linetype = "dashed")
plot_E2_cffi_rt <- emm_E2_rt_fi[1:8] %>% 
  as_tibble() %>% 
  ggplot(aes(y = estimate, x = Cue, color = Congruency)) +
  geom_point(size = 2) +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0, 
                alpha = .6) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  facet_grid(Probability ~ Congruency, switch = "x",
             labeller = labeller(Probability = c(`0.25` = "25% cueing top", `0.75` = "75% cueing top"))) +
  coord_cartesian(ylim = ylimit_cf_fi_rt) +  # set the limit for y axis c(0, 1100)
  labs(x = "Congruency", y = expression(RT~"(aligned-misaligned)")) +  # set the names for main, x and y axises
  theme_bw() +
  theme(
    text = element_text(size = 10),
    axis.title = element_text(size = 16), 
    axis.text = element_text(size = 14), # the size of the texts in plot
    # axis.text.x = element_text(angle = 45, vjust = 0.5),
    legend.title=element_text(size=15),
    legend.text=element_text(size=14),
    legend.position = "none",
    legend.key.width = unit(1.2, "cm"),
    plot.title = element_text(lineheight=.8, face="bold", size = 17),
    panel.border = element_blank(),
    panel.grid.minor = element_blank(),
    panel.grid.major = element_blank(),
    axis.line.x = element_line(colour = 'black', size=0.5, linetype='solid'),
    axis.line.y = element_line(colour = 'black', size=0.5, linetype='solid'),
    # remove the facet background color
    strip.text = element_text(face="bold", size=14, lineheight=5.0),
    strip.background = element_rect(fill="white", colour="white", size=1),
    strip.placement = "outside"
  ) +
  NULL

# ggsave(filename = "E2_fi_rt.pdf", plot_E2_cffi_rt, width = 7, height = 4.55)
plot_E2_cffi_rt

plot_E2_cf_rt_ <- plot_E2_cf_rt +
  guides(color = guide_legend(nrow = 1, title.position = "left"), 
         linetype = guide_legend(nrow = 1, title.position = "left")) +
  theme(legend.position = c(0.6, 0.5),
        legend.box = "horizontal") 

plot_E2_rt <- ggarrange(plot_E2_cf_rt_, plot_E2_cffi_rt, 
                       labels = c("A", "B"),
                       font.label = (list(size = 20)),
                       widths = c(1.5, 1),
                       nrow = 1)

# ggsave(filename = "E2_rt.pdf", plot_E2_rt, width = 10, height = 7)
plot_E2_rt

3.2.2.4 Comparisons between facilitation and interference

contrast(emm_E2_rt_fi, method = list("faci-inte"=c(1, 1)), by = c("Cue", "Probability"))[1:4] %>% 
  summary(infer = TRUE)
##  contrast  Cue    Probability estimate   SE  df asymp.LCL asymp.UCL z.ratio p.value
##  faci-inte top    0.25          -40.86 23.2 Inf     -86.3      4.58  -1.762  0.0780
##  faci-inte bottom 0.25            1.08 12.2 Inf     -22.9     25.04   0.088  0.9299
##  faci-inte top    0.75          -16.18 12.2 Inf     -40.2      7.79  -1.323  0.1859
##  faci-inte bottom 0.75          -78.07 24.4 Inf    -125.9    -30.27  -3.201  0.0014
## 
## Confidence level used: 0.95

4 Experiment 1 and 2

4.1 Responses (d’)

4.1.1 Fitting the generalized mixed models

4.1.1.1 The maximal model

# file_resp_max <- file.path(folder_lmm, "Resp_lmm_max.RData")
# 
# # fit the max model
# if (!file.exists(file_resp_max)) {
#   glmm_resp_max <- glmer(
#     Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability +
#       (Cue * Congruency * Alignment * SameDifferent | Participant), # Con_Ali_Sam
#     family = binomial(link = "probit"),
#     data = df_lmm,
#     control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
#                            optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
#   )
# 
#   save(glmm_resp_max, file = file_resp_max)
# } else {
#   load(file_resp_max)
# }
# 
# print(summary(glmm_resp_max), corr = FALSE)

4.1.1.2 The zero-correlation-parameter model

file_resp_zcp <- file.path(folder_lmm, "Resp_lmm_zcp.RData")

# fit the zcp model
if (!file.exists(file_resp_zcp)) {
  glmm_resp_zcp <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + 
      (Cue_C + Con_C + Ali_C + Sam_C + 
         Cue_Con + Cue_Ali + Cue_Sam + Con_Ali + Con_Sam + Ali_Sam +
         Cue_Con_Ali + Cue_Con_Sam + Cue_Ali_Sam + Con_Ali_Sam + 
         Cue_Con_Ali_Sam || Participant),
    family = binomial(link = "probit"),
    data = df_lmm,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  
  # save(glmm_resp_zcp, file = file_resp_zcp)
} else {
  load(file_resp_zcp)
}

print(summary(glmm_resp_zcp), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability +      (Cue_C + Con_C + Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam +          Con_Ali + Con_Sam + Ali_Sam + Cue_Con_Ali + Cue_Con_Sam +          Cue_Ali_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam || Participant)
##    Data: df_lmm
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  63102.7  63409.5 -31517.3  63034.7    61403 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -7.7530 -0.6145  0.2261  0.5866  4.5197 
## 
## Random effects:
##  Groups         Name            Variance  Std.Dev. 
##  Participant    (Intercept)     6.440e-02 2.538e-01
##  Participant.1  Cue_C           1.251e-01 3.536e-01
##  Participant.2  Con_C           5.088e-03 7.133e-02
##  Participant.3  Ali_C           3.884e-02 1.971e-01
##  Participant.4  Sam_C           2.193e-01 4.683e-01
##  Participant.5  Cue_Con         5.078e-03 7.126e-02
##  Participant.6  Cue_Ali         4.189e-02 2.047e-01
##  Participant.7  Cue_Sam         7.770e-01 8.815e-01
##  Participant.8  Con_Ali         0.000e+00 0.000e+00
##  Participant.9  Con_Sam         3.261e-01 5.710e-01
##  Participant.10 Ali_Sam         1.306e-14 1.143e-07
##  Participant.11 Cue_Con_Ali     0.000e+00 0.000e+00
##  Participant.12 Cue_Con_Sam     1.253e+00 1.120e+00
##  Participant.13 Cue_Ali_Sam     1.401e-03 3.743e-02
##  Participant.14 Con_Ali_Sam     1.067e-01 3.267e-01
##  Participant.15 Cue_Con_Ali_Sam 5.275e-02 2.297e-01
## Number of obs: 61437, groups:  Participant, 64
## 
## Fixed effects:
##                                                     Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                         0.133017   0.046191   2.880 0.003981 ** 
## Cue2-1                                              0.088095   0.046155   1.909 0.056305 .  
## Congruency2-1                                      -0.143440   0.015205  -9.434  < 2e-16 ***
## Alignment2-1                                        0.056608   0.027580   2.052 0.040126 *  
## SameDifferent2-1                                   -1.366284   0.059928 -22.799  < 2e-16 ***
## Probability0.5                                      0.042453   0.065205   0.651 0.515005    
## Probability0.75                                     0.030363   0.016168   1.878 0.060389 .  
## Cue2-1:Congruency2-1                               -0.010243   0.025779  -0.397 0.691134    
## Cue2-1:Alignment2-1                                -0.103310   0.035394  -2.919 0.003514 ** 
## Congruency2-1:Alignment2-1                          0.127143   0.023738   5.356 8.50e-08 ***
## Cue2-1:SameDifferent2-1                             0.318684   0.113248   2.814 0.004892 ** 
## Congruency2-1:SameDifferent2-1                      1.032331   0.075649  13.646  < 2e-16 ***
## Alignment2-1:SameDifferent2-1                       0.010627   0.023866   0.445 0.656103    
## Cue2-1:Congruency2-1:Alignment2-1                  -0.002245   0.047390  -0.047 0.962220    
## Cue2-1:Congruency2-1:SameDifferent2-1              -0.078199   0.148665  -0.526 0.598884    
## Cue2-1:Alignment2-1:SameDifferent2-1                0.167988   0.047931   3.505 0.000457 ***
## Congruency2-1:Alignment2-1:SameDifferent2-1        -0.573895   0.063344  -9.060  < 2e-16 ***
## Cue2-1:Congruency2-1:Alignment2-1:SameDifferent2-1  0.632166   0.099337   6.364 1.97e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular

4.1.1.3 The reduced model

summary(rePCA(glmm_resp_zcp))
## $Participant
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]    [,6]    [,7]    [,8]    [,9]   [,10]   [,11]   [,12]   [,13]     [,14] [,15] [,16]
## Standard deviation     1.1196 0.8815 0.5710 0.46832 0.35363 0.32667 0.25378 0.22966 0.20467 0.19708 0.07133 0.07126 0.03743 1.143e-07     0     0
## Proportion of Variance 0.4154 0.2575 0.1081 0.07269 0.04145 0.03537 0.02135 0.01748 0.01388 0.01287 0.00169 0.00168 0.00046 0.000e+00     0     0
## Cumulative Proportion  0.4154 0.6730 0.7811 0.85376 0.89521 0.93058 0.95193 0.96941 0.98329 0.99617 0.99785 0.99954 1.00000 1.000e+00     1     1

Con_Ali, Ali_Sam, Cue_Con_Ali, and Cue_Ali_Sam were removed from extended model (glmm_resp_etd) due to that the variances they explained were smaller than 0.1%, making glmm_resp_rdc.

file_resp_rdc <- file.path(folder_lmm, "Resp_lmm_rdc.RData")

# fit the zcp model
# three random effects were removed
if (!file.exists(file_resp_rdc)) {
  glmm_resp_rdc <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + 
      (Cue_C + Con_C + Ali_C + Sam_C + 
         Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam + 
         Cue_Con_Sam + Con_Ali_Sam +# Cue_Con_Ali + Cue_Ali_Sam + 
         Cue_Con_Ali_Sam || Participant),
    family = binomial(link = "probit"),
    data = df_lmm,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  
  # save(glmm_resp_rdc, file = file_resp_rdc)
} else {
  load(file_resp_rdc)
}

print(summary(glmm_resp_rdc), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability +      (Cue_C + Con_C + Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam +          Con_Sam + Cue_Con_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam ||          Participant)
##    Data: df_lmm
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  63094.7  63365.4 -31517.3  63034.7    61407 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -7.7510 -0.6146  0.2259  0.5868  4.5215 
## 
## Random effects:
##  Groups         Name            Variance Std.Dev.
##  Participant    (Intercept)     0.064402 0.25378 
##  Participant.1  Cue_C           0.125050 0.35362 
##  Participant.2  Con_C           0.005088 0.07133 
##  Participant.3  Ali_C           0.038835 0.19707 
##  Participant.4  Sam_C           0.219322 0.46832 
##  Participant.5  Cue_Con         0.005079 0.07127 
##  Participant.6  Cue_Ali         0.041875 0.20463 
##  Participant.7  Cue_Sam         0.777015 0.88148 
##  Participant.8  Con_Sam         0.326078 0.57103 
##  Participant.9  Cue_Con_Sam     1.253376 1.11954 
##  Participant.10 Con_Ali_Sam     0.106723 0.32669 
##  Participant.11 Cue_Con_Ali_Sam 0.052783 0.22975 
## Number of obs: 61437, groups:  Participant, 64
## 
## Fixed effects:
##                                                     Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                         0.133020   0.046193   2.880 0.003981 ** 
## Cue2-1                                              0.088085   0.046163   1.908 0.056376 .  
## Congruency2-1                                      -0.143434   0.015204  -9.434  < 2e-16 ***
## Alignment2-1                                        0.056618   0.027582   2.053 0.040104 *  
## SameDifferent2-1                                   -1.366260   0.059919 -22.802  < 2e-16 ***
## Probability0.5                                      0.042443   0.065206   0.651 0.515106    
## Probability0.75                                     0.030360   0.016168   1.878 0.060405 .  
## Cue2-1:Congruency2-1                               -0.010254   0.025777  -0.398 0.690775    
## Cue2-1:Alignment2-1                                -0.103374   0.035371  -2.923 0.003472 ** 
## Congruency2-1:Alignment2-1                          0.127151   0.023736   5.357 8.47e-08 ***
## Cue2-1:SameDifferent2-1                             0.318680   0.112984   2.821 0.004794 ** 
## Congruency2-1:SameDifferent2-1                      1.032317   0.075768  13.625  < 2e-16 ***
## Alignment2-1:SameDifferent2-1                       0.010682   0.023847   0.448 0.654191    
## Cue2-1:Congruency2-1:Alignment2-1                  -0.002169   0.047379  -0.046 0.963483    
## Cue2-1:Congruency2-1:SameDifferent2-1              -0.078201   0.148731  -0.526 0.599036    
## Cue2-1:Alignment2-1:SameDifferent2-1                0.167813   0.047598   3.526 0.000423 ***
## Congruency2-1:Alignment2-1:SameDifferent2-1        -0.573905   0.063347  -9.060  < 2e-16 ***
## Cue2-1:Congruency2-1:Alignment2-1:SameDifferent2-1  0.632150   0.099361   6.362 1.99e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

4.1.1.4 The extended model

file_resp_etd <- file.path(folder_lmm, "Resp_lmm_etd.RData")

# fit the etd model
if (!file.exists(file_resp_etd)) {
  glmm_resp_etd <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + 
      (Cue_C + Con_C + Ali_C + Sam_C + 
         Cue_Con + Cue_Ali + Cue_Sam + Con_Sam + # Con_Ali + Ali_Sam + 
         Cue_Con_Sam + Con_Ali_Sam +# Cue_Con_Ali + Cue_Ali_Sam + 
         Cue_Con_Ali_Sam | Participant),
    family = binomial(link = "probit"),
    data = df_lmm,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  
  # save(glmm_resp_etd, file = glmm_resp_etd)
} else {
  load(file_resp_etd)
}

print(summary(glmm_resp_etd), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability +      (Cue_C + Con_C + Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam +          Con_Sam + Cue_Con_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam |          Participant)
##    Data: df_lmm
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  63083.0  63949.5 -31445.5  62891.0    61341 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -7.7764 -0.6110  0.2195  0.5860  5.2220 
## 
## Random effects:
##  Groups      Name            Variance Std.Dev. Corr                                                             
##  Participant (Intercept)     0.06868  0.26206                                                                   
##              Cue_C           0.12513  0.35374  -0.12                                                            
##              Con_C           0.00580  0.07616  -0.44 -0.09                                                      
##              Ali_C           0.03871  0.19674   0.14 -0.02 -0.24                                                
##              Sam_C           0.22202  0.47119  -0.07 -0.16  0.59 -0.17                                          
##              Cue_Con         0.01401  0.11837   0.02  0.15  0.45 -0.36  0.38                                    
##              Cue_Ali         0.04120  0.20297  -0.40 -0.04  0.22 -0.16  0.23  0.06                              
##              Cue_Sam         0.76967  0.87731   0.29  0.03 -0.32  0.17  0.01 -0.49 -0.29                        
##              Con_Sam         0.33708  0.58059  -0.02 -0.22 -0.50  0.01 -0.18  0.02  0.07  0.03                  
##              Cue_Con_Sam     1.24261  1.11473   0.04 -0.07 -0.21  0.09 -0.01 -0.61 -0.32  0.77  0.22            
##              Con_Ali_Sam     0.10948  0.33088   0.08  0.17  0.24 -0.07  0.27 -0.36  0.06  0.40 -0.46  0.44      
##              Cue_Con_Ali_Sam 0.19553  0.44219   0.15 -0.02 -0.38  0.02 -0.35  0.02  0.05  0.10 -0.07 -0.45 -0.39
## Number of obs: 61437, groups:  Participant, 64
## 
## Fixed effects:
##                                                     Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                         0.190215   0.049826   3.818 0.000135 ***
## Cue2-1                                              0.086308   0.046234   1.867 0.061935 .  
## Congruency2-1                                      -0.146568   0.015757  -9.302  < 2e-16 ***
## Alignment2-1                                        0.057107   0.027607   2.069 0.038586 *  
## SameDifferent2-1                                   -1.367728   0.060308 -22.679  < 2e-16 ***
## Probability0.5                                     -0.068135   0.073251  -0.930 0.352287    
## Probability0.75                                     0.030948   0.016186   1.912 0.055867 .  
## Cue2-1:Congruency2-1                               -0.008224   0.029046  -0.283 0.777083    
## Cue2-1:Alignment2-1                                -0.102079   0.035450  -2.880 0.003983 ** 
## Congruency2-1:Alignment2-1                          0.130176   0.024030   5.417 6.06e-08 ***
## Cue2-1:SameDifferent2-1                             0.313897   0.112803   2.783 0.005391 ** 
## Congruency2-1:SameDifferent2-1                      1.030473   0.076980  13.386  < 2e-16 ***
## Alignment2-1:SameDifferent2-1                       0.013823   0.024049   0.575 0.565436    
## Cue2-1:Congruency2-1:Alignment2-1                  -0.008231   0.048046  -0.171 0.863980    
## Cue2-1:Congruency2-1:SameDifferent2-1              -0.049411   0.148288  -0.333 0.738973    
## Cue2-1:Alignment2-1:SameDifferent2-1                0.171521   0.048081   3.567 0.000361 ***
## Congruency2-1:Alignment2-1:SameDifferent2-1        -0.592064   0.064222  -9.219  < 2e-16 ***
## Cue2-1:Congruency2-1:Alignment2-1:SameDifferent2-1  0.664157   0.112066   5.926 3.10e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1 
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_resp_etd))
## $Participant
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]    [,6]    [,7]    [,8]    [,9]   [,10]   [,11]     [,12]
## Standard deviation     1.3617 0.6534 0.6171 0.45717 0.33683 0.27047 0.22740 0.19526 0.11588 0.09401 0.01508 2.882e-05
## Proportion of Variance 0.5849 0.1347 0.1201 0.06593 0.03579 0.02308 0.01631 0.01203 0.00424 0.00279 0.00007 0.000e+00
## Cumulative Proportion  0.5849 0.7196 0.8398 0.90570 0.94149 0.96456 0.98088 0.99290 0.99714 0.99993 1.00000 1.000e+00

Con_C, Cue_Con, Ali_C, and Cue_Ali was removed from extended model.

file_resp_etd1 <- file.path(folder_lmm, "Resp_lmm_etd1.RData")

# fit the etd1 model
if (!file.exists(file_resp_etd1)) {
  glmm_resp_etd1 <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + 
      (Cue_C + Sam_C + # Con_C + Ali_C +
         Cue_Sam + Con_Sam + # Cue_Con + Con_Ali + Ali_Sam + Cue_Ali + 
         Cue_Con_Sam + Con_Ali_Sam +# Cue_Con_Ali + Cue_Ali_Sam + 
         Cue_Con_Ali_Sam | Participant),
    family = binomial(link = "probit"),
    data = df_lmm,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_resp_etd1, file = glmm_resp_etd1)
} else {
  load(file_resp_etd1)
}

print(summary(glmm_resp_etd1), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability +      (Cue_C + Sam_C + Cue_Sam + Con_Sam + Cue_Con_Sam + Con_Ali_Sam +          Cue_Con_Ali_Sam | Participant)
##    Data: df_lmm
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  63245.1  63732.5 -31568.6  63137.1    61383 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -6.8485 -0.6094  0.2430  0.5779  4.6281 
## 
## Random effects:
##  Groups      Name            Variance Std.Dev. Corr                                     
##  Participant (Intercept)     0.06446  0.2539                                            
##              Cue_C           0.12309  0.3508   -0.11                                    
##              Sam_C           0.21481  0.4635   -0.08 -0.16                              
##              Cue_Sam         0.76338  0.8737    0.28  0.02  0.01                        
##              Con_Sam         0.32412  0.5693   -0.04 -0.22 -0.16  0.03                  
##              Cue_Con_Sam     1.21246  1.1011    0.06 -0.08  0.00  0.77  0.23            
##              Con_Ali_Sam     0.11567  0.3401    0.11  0.16  0.28  0.41 -0.44  0.45      
##              Cue_Con_Ali_Sam 0.18204  0.4267    0.13  0.03 -0.39  0.11 -0.05 -0.47 -0.43
## Number of obs: 61437, groups:  Participant, 64
## 
## Fixed effects:
##                                                     Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                         0.157667   0.048780   3.232 0.001228 ** 
## Cue2-1                                              0.086991   0.045839   1.898 0.057728 .  
## Congruency2-1                                      -0.138649   0.011955 -11.597  < 2e-16 ***
## Alignment2-1                                        0.040306   0.011744   3.432 0.000599 ***
## SameDifferent2-1                                   -1.353450   0.059365 -22.799  < 2e-16 ***
## Probability0.5                                     -0.011632   0.072389  -0.161 0.872343    
## Probability0.75                                     0.030488   0.016134   1.890 0.058796 .  
## Cue2-1:Congruency2-1                               -0.007521   0.023914  -0.315 0.753140    
## Cue2-1:Alignment2-1                                -0.087931   0.023489  -3.744 0.000181 ***
## Congruency2-1:Alignment2-1                          0.130470   0.023736   5.497 3.87e-08 ***
## Cue2-1:SameDifferent2-1                             0.309046   0.112533   2.746 0.006028 ** 
## Congruency2-1:SameDifferent2-1                      1.014579   0.075450  13.447  < 2e-16 ***
## Alignment2-1:SameDifferent2-1                       0.022333   0.023544   0.949 0.342848    
## Cue2-1:Congruency2-1:Alignment2-1                  -0.015297   0.047475  -0.322 0.747286    
## Cue2-1:Congruency2-1:SameDifferent2-1              -0.058703   0.146943  -0.399 0.689527    
## Cue2-1:Alignment2-1:SameDifferent2-1                0.143644   0.047082   3.051 0.002281 ** 
## Congruency2-1:Alignment2-1:SameDifferent2-1        -0.592199   0.064522  -9.178  < 2e-16 ***
## Cue2-1:Congruency2-1:Alignment2-1:SameDifferent2-1  0.678179   0.110018   6.164 7.08e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_resp_etd1))
## $Participant
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]    [,6]    [,7]      [,8]
## Standard deviation     1.3463 0.6445 0.6092 0.44009 0.32770 0.24962 0.19412 2.881e-05
## Proportion of Variance 0.6042 0.1384 0.1237 0.06456 0.03579 0.02077 0.01256 0.000e+00
## Cumulative Proportion  0.6042 0.7426 0.8663 0.93087 0.96667 0.98744 1.00000 1.000e+00

Intercept was removed from extended1 model.

file_resp_etd2 <- file.path(folder_lmm, "Resp_lmm_etd2.RData")

# fit the etd2 model
if (!file.exists(file_resp_etd2)) {
  glmm_resp_etd2 <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + 
      (0 + Cue_C + Sam_C + # Con_C + Ali_C +
         Cue_Sam + Con_Sam + # Cue_Con + Con_Ali + Ali_Sam + Cue_Ali + 
         Cue_Con_Sam + Con_Ali_Sam +# Cue_Con_Ali + Cue_Ali_Sam + 
         Cue_Con_Ali_Sam | Participant),
    family = binomial(link = "probit"),
    data = df_lmm,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  
  # save(glmm_resp_etd2, file = glmm_resp_etd2)
} else {
  load(file_resp_etd2)
}

print(summary(glmm_resp_etd2), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability +      (0 + Cue_C + Sam_C + Cue_Sam + Con_Sam + Cue_Con_Sam + Con_Ali_Sam +          Cue_Con_Ali_Sam | Participant)
##    Data: df_lmm
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  64871.6  65286.8 -32389.8  64779.6    61391 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.3445 -0.6291  0.2780  0.5980  4.0776 
## 
## Random effects:
##  Groups      Name            Variance Std.Dev. Corr                               
##  Participant Cue_C           0.1154   0.3397                                      
##              Sam_C           0.2102   0.4584   -0.20                              
##              Cue_Sam         0.7150   0.8456    0.08  0.02                        
##              Con_Sam         0.3213   0.5668   -0.22 -0.19  0.03                  
##              Cue_Con_Sam     1.1358   1.0657   -0.10  0.02  0.74  0.23            
##              Con_Ali_Sam     0.1080   0.3286    0.17  0.30  0.44 -0.47  0.45      
##              Cue_Con_Ali_Sam 0.1371   0.3703    0.08 -0.41  0.09 -0.05 -0.51 -0.44
## Number of obs: 61437, groups:  Participant, 64
## 
## Fixed effects:
##                                                     Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                         0.123252   0.010709  11.509  < 2e-16 ***
## Cue2-1                                              0.099768   0.044345   2.250 0.024459 *  
## Congruency2-1                                      -0.129109   0.011622 -11.109  < 2e-16 ***
## Alignment2-1                                        0.037931   0.011558   3.282 0.001031 ** 
## SameDifferent2-1                                   -1.314484   0.058587 -22.436  < 2e-16 ***
## Probability0.5                                      0.043315   0.014521   2.983 0.002855 ** 
## Probability0.75                                     0.028661   0.015913   1.801 0.071684 .  
## Cue2-1:Congruency2-1                               -0.013110   0.023309  -0.562 0.573820    
## Cue2-1:Alignment2-1                                -0.086384   0.023115  -3.737 0.000186 ***
## Congruency2-1:Alignment2-1                          0.126081   0.023204   5.434 5.53e-08 ***
## Cue2-1:SameDifferent2-1                             0.285404   0.108480   2.631 0.008515 ** 
## Congruency2-1:SameDifferent2-1                      0.984935   0.074950  13.141  < 2e-16 ***
## Alignment2-1:SameDifferent2-1                       0.025026   0.023195   1.079 0.280613    
## Cue2-1:Congruency2-1:Alignment2-1                  -0.004488   0.046413  -0.097 0.922973    
## Cue2-1:Congruency2-1:SameDifferent2-1              -0.053188   0.141838  -0.375 0.707667    
## Cue2-1:Alignment2-1:SameDifferent2-1                0.133972   0.046382   2.888 0.003872 ** 
## Congruency2-1:Alignment2-1:SameDifferent2-1        -0.573698   0.062888  -9.123  < 2e-16 ***
## Cue2-1:Congruency2-1:Alignment2-1:SameDifferent2-1  0.646349   0.105219   6.143 8.10e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_resp_etd2))
## $Participant
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5]    [,6]      [,7]
## Standard deviation     1.2954 0.6398 0.5808 0.42799 0.31414 0.19015 8.192e-06
## Proportion of Variance 0.6118 0.1492 0.1230 0.06679 0.03598 0.01318 0.000e+00
## Cumulative Proportion  0.6118 0.7611 0.8841 0.95084 0.98682 1.00000 1.000e+00

Con_Ali_Sam was removed from extended1 model.

file_resp_etd3 <- file.path(folder_lmm, "Resp_lmm_etd3.RData")

# fit the etd3 model
if (!file.exists(file_resp_etd3)) {
  glmm_resp_etd3 <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + 
      (0 + Cue_C + Sam_C + # Con_C + Ali_C +
         Cue_Sam + Con_Sam + # Cue_Con + Con_Ali + Ali_Sam + Cue_Ali + 
         Cue_Con_Sam + # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam +
         Cue_Con_Ali_Sam | Participant),
    family = binomial(link = "probit"),
    data = df_lmm,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_resp_etd3, file = glmm_resp_etd3)
} else {
  load(file_resp_etd3)
}

print(summary(glmm_resp_etd3), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability +      (0 + Cue_C + Sam_C + Cue_Sam + Con_Sam + Cue_Con_Sam + Cue_Con_Ali_Sam |          Participant)
##    Data: df_lmm
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  64887.2  65239.2 -32404.6  64809.2    61398 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.0379 -0.6276  0.2795  0.5984  4.4562 
## 
## Random effects:
##  Groups      Name            Variance Std.Dev. Corr                         
##  Participant Cue_C           0.1153   0.3396                                
##              Sam_C           0.2089   0.4571   -0.20                        
##              Cue_Sam         0.7157   0.8460    0.08  0.02                  
##              Con_Sam         0.3171   0.5631   -0.22 -0.18  0.03            
##              Cue_Con_Sam     1.1279   1.0620   -0.10  0.02  0.74  0.24      
##              Cue_Con_Ali_Sam 0.1336   0.3655    0.08 -0.41  0.10 -0.05 -0.51
## Number of obs: 61437, groups:  Participant, 64
## 
## Fixed effects:
##                                                     Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                         0.123177   0.010705  11.507  < 2e-16 ***
## Cue2-1                                              0.099649   0.044331   2.248 0.024588 *  
## Congruency2-1                                      -0.128751   0.011616 -11.084  < 2e-16 ***
## Alignment2-1                                        0.038946   0.011548   3.373 0.000745 ***
## SameDifferent2-1                                   -1.312469   0.058439 -22.459  < 2e-16 ***
## Probability0.5                                      0.043090   0.014511   2.969 0.002984 ** 
## Probability0.75                                     0.028336   0.015907   1.781 0.074848 .  
## Cue2-1:Congruency2-1                               -0.013659   0.023291  -0.586 0.557572    
## Cue2-1:Alignment2-1                                -0.087068   0.023090  -3.771 0.000163 ***
## Congruency2-1:Alignment2-1                          0.124404   0.023176   5.368 7.98e-08 ***
## Cue2-1:SameDifferent2-1                             0.284202   0.108399   2.622 0.008746 ** 
## Congruency2-1:SameDifferent2-1                      0.981504   0.074559  13.164  < 2e-16 ***
## Alignment2-1:SameDifferent2-1                       0.017419   0.023101   0.754 0.450821    
## Cue2-1:Congruency2-1:Alignment2-1                  -0.002189   0.046186  -0.047 0.962202    
## Cue2-1:Congruency2-1:SameDifferent2-1              -0.049675   0.141367  -0.351 0.725299    
## Cue2-1:Alignment2-1:SameDifferent2-1                0.136374   0.046292   2.946 0.003219 ** 
## Congruency2-1:Alignment2-1:SameDifferent2-1        -0.553813   0.046301 -11.961  < 2e-16 ***
## Cue2-1:Congruency2-1:Alignment2-1:SameDifferent2-1  0.652923   0.104533   6.246 4.21e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_resp_etd3))
## $Participant
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]    [,5] [,6]
## Standard deviation     1.2832 0.6208 0.5559 0.42463 0.31154    0
## Proportion of Variance 0.6289 0.1472 0.1180 0.06886 0.03707    0
## Cumulative Proportion  0.6289 0.7761 0.8941 0.96293 1.00000    1

Cue_C was removed.

file_resp_etd4 <- file.path(folder_lmm, "Resp_lmm_etd4.RData")

# fit the etd4 model
if (!file.exists(file_resp_etd4)) {
  glmm_resp_etd4 <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + 
      (0 + Sam_C + # Con_C + Ali_C + Cue_C + 
         Cue_Sam + Con_Sam + # Cue_Con + Con_Ali + Ali_Sam + Cue_Ali + 
         Cue_Con_Sam + # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam +
         Cue_Con_Ali_Sam | Participant),
    family = binomial(link = "probit"),
    data = df_lmm,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_resp_etd4, file = glmm_resp_etd4)
} else {
  load(file_resp_etd4)
}

print(summary(glmm_resp_etd4), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability +      (0 + Sam_C + Cue_Sam + Con_Sam + Cue_Con_Sam + Cue_Con_Ali_Sam |          Participant)
##    Data: df_lmm
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  65595.0  65892.8 -32764.5  65529.0    61404 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.9069 -0.6337  0.2870  0.5997  3.5592 
## 
## Random effects:
##  Groups      Name            Variance Std.Dev. Corr                   
##  Participant Sam_C           0.2053   0.4531                          
##              Cue_Sam         0.7240   0.8509    0.01                  
##              Con_Sam         0.3154   0.5616   -0.19  0.02            
##              Cue_Con_Sam     1.1390   1.0672    0.03  0.70  0.26      
##              Cue_Con_Ali_Sam 0.1293   0.3595   -0.46  0.13 -0.06 -0.53
## Number of obs: 61437, groups:  Participant, 64
## 
## Fixed effects:
##                                                     Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                         0.129522   0.010355  12.508  < 2e-16 ***
## Cue2-1                                              0.105943   0.012411   8.536  < 2e-16 ***
## Congruency2-1                                      -0.128304   0.011488 -11.168  < 2e-16 ***
## Alignment2-1                                        0.038831   0.011471   3.385 0.000711 ***
## SameDifferent2-1                                   -1.296669   0.057890 -22.399  < 2e-16 ***
## Probability0.5                                      0.037871   0.014127   2.681 0.007344 ** 
## Probability0.75                                     0.014138   0.015141   0.934 0.350402    
## Cue2-1:Congruency2-1                               -0.013638   0.022974  -0.594 0.552769    
## Cue2-1:Alignment2-1                                -0.086152   0.022946  -3.755 0.000174 ***
## Congruency2-1:Alignment2-1                          0.124053   0.022943   5.407 6.41e-08 ***
## Cue2-1:SameDifferent2-1                             0.280842   0.109001   2.577 0.009981 ** 
## Congruency2-1:SameDifferent2-1                      0.971848   0.074277  13.084  < 2e-16 ***
## Alignment2-1:SameDifferent2-1                       0.017533   0.022956   0.764 0.445022    
## Cue2-1:Congruency2-1:Alignment2-1                  -0.002098   0.045909  -0.046 0.963548    
## Cue2-1:Congruency2-1:SameDifferent2-1              -0.047721   0.141789  -0.337 0.736445    
## Cue2-1:Alignment2-1:SameDifferent2-1                0.134706   0.046006   2.928 0.003412 ** 
## Congruency2-1:Alignment2-1:SameDifferent2-1        -0.550741   0.046034 -11.964  < 2e-16 ***
## Cue2-1:Congruency2-1:Alignment2-1:SameDifferent2-1  0.639901   0.103436   6.186 6.15e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
summary(rePCA(glmm_resp_etd4))
## $Participant
## Importance of components:
##                          [,1]   [,2]   [,3]    [,4]      [,5]
## Standard deviation     1.2764 0.6366 0.5607 0.40497 1.158e-05
## Proportion of Variance 0.6484 0.1613 0.1251 0.06526 0.000e+00
## Cumulative Proportion  0.6484 0.8096 0.9347 1.00000 1.000e+00

Cue_Con_Ali_Sam was removed.

file_resp_etd5 <- file.path(folder_lmm, "Resp_lmm_etd5.RData")

# fit the etd5 model
if (!file.exists(file_resp_etd5)) {
  glmm_resp_etd5 <- glmer(
    Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + 
      (0 + Sam_C + # Con_C + Ali_C + Cue_C + 
         Cue_Sam + Con_Sam + # Cue_Con + Con_Ali + Ali_Sam + Cue_Ali + 
         Cue_Con_Sam  # Cue_Con_Ali + Cue_Ali_Sam + Con_Ali_Sam + +
          | Participant), # Cue_Con_Ali_Sam
    family = binomial(link = "probit"),
    data = df_lmm,
    control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                           optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_resp_etd5, file = glmm_resp_etd5)
} else {
  load(file_resp_etd5)
}

print(summary(glmm_resp_etd5), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability +      (0 + Sam_C + Cue_Sam + Con_Sam + Cue_Con_Sam | Participant)
##    Data: df_lmm
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  65596.2  65848.9 -32770.1  65540.2    61409 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.8313 -0.6303  0.2892  0.6016  3.5395 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev. Corr             
##  Participant Sam_C       0.2049   0.4527                    
##              Cue_Sam     0.7207   0.8489    0.01            
##              Con_Sam     0.3154   0.5616   -0.19  0.02      
##              Cue_Con_Sam 1.1323   1.0641    0.03  0.71  0.26
## Number of obs: 61437, groups:  Participant, 64
## 
## Fixed effects:
##                                                      Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                         0.1294660  0.0103554  12.502  < 2e-16 ***
## Cue2-1                                              0.1061128  0.0124089   8.551  < 2e-16 ***
## Congruency2-1                                      -0.1282620  0.0114863 -11.166  < 2e-16 ***
## Alignment2-1                                        0.0390641  0.0114681   3.406 0.000658 ***
## SameDifferent2-1                                   -1.2958485  0.0579395 -22.366  < 2e-16 ***
## Probability0.5                                      0.0377466  0.0141252   2.672 0.007534 ** 
## Probability0.75                                     0.0142471  0.0151415   0.941 0.346742    
## Cue2-1:Congruency2-1                               -0.0134839  0.0229744  -0.587 0.557266    
## Cue2-1:Alignment2-1                                -0.0866271  0.0229394  -3.776 0.000159 ***
## Congruency2-1:Alignment2-1                          0.1243850  0.0229390   5.422 5.88e-08 ***
## Cue2-1:SameDifferent2-1                             0.2793811  0.1090565   2.562 0.010413 *  
## Congruency2-1:SameDifferent2-1                      0.9710948  0.0744207  13.049  < 2e-16 ***
## Alignment2-1:SameDifferent2-1                       0.0151448  0.0229397   0.660 0.509124    
## Cue2-1:Congruency2-1:Alignment2-1                   0.0004411  0.0458931   0.010 0.992331    
## Cue2-1:Congruency2-1:SameDifferent2-1              -0.0459603  0.1419862  -0.324 0.746168    
## Cue2-1:Alignment2-1:SameDifferent2-1                0.1389068  0.0459013   3.026 0.002476 ** 
## Congruency2-1:Alignment2-1:SameDifferent2-1        -0.5438443  0.0458885 -11.851  < 2e-16 ***
## Cue2-1:Congruency2-1:Alignment2-1:SameDifferent2-1  0.6052064  0.0918957   6.586 4.52e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

4.1.1.5 The optimal model

# compare the extended and reduced model
anova(glmm_resp_etd5, glmm_resp_rdc, refit = FALSE)
## Data: df_lmm
## Models:
## glmm_resp_etd5: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + 
## glmm_resp_etd5:     (0 + Sam_C + Cue_Sam + Con_Sam + Cue_Con_Sam | Participant)
## glmm_resp_rdc: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability + 
## glmm_resp_rdc:     (Cue_C + Con_C + Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam + 
## glmm_resp_rdc:         Con_Sam + Cue_Con_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam || 
## glmm_resp_rdc:         Participant)
##                npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)    
## glmm_resp_etd5   28 65596 65849 -32770    65540                         
## glmm_resp_rdc    30 63095 63365 -31517    63035 2505.5  2  < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

According to BIC, the reduced model (glmm_resp_rdc) explained the data better than the extended model (glmm_resp_etd5) and, therefore, the reduced model is used as the optimal model.

glmm_resp_opt <- glmm_resp_rdc

print(summary(glmm_resp_opt), corr = FALSE)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
##  Family: binomial  ( probit )
## Formula: Resp ~ Cue * Congruency * Alignment * SameDifferent + Probability +      (Cue_C + Con_C + Ali_C + Sam_C + Cue_Con + Cue_Ali + Cue_Sam +          Con_Sam + Cue_Con_Sam + Con_Ali_Sam + Cue_Con_Ali_Sam ||          Participant)
##    Data: df_lmm
## Control: glmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
##      AIC      BIC   logLik deviance df.resid 
##  63094.7  63365.4 -31517.3  63034.7    61407 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -7.7510 -0.6146  0.2259  0.5868  4.5215 
## 
## Random effects:
##  Groups         Name            Variance Std.Dev.
##  Participant    (Intercept)     0.064402 0.25378 
##  Participant.1  Cue_C           0.125050 0.35362 
##  Participant.2  Con_C           0.005088 0.07133 
##  Participant.3  Ali_C           0.038835 0.19707 
##  Participant.4  Sam_C           0.219322 0.46832 
##  Participant.5  Cue_Con         0.005079 0.07127 
##  Participant.6  Cue_Ali         0.041875 0.20463 
##  Participant.7  Cue_Sam         0.777015 0.88148 
##  Participant.8  Con_Sam         0.326078 0.57103 
##  Participant.9  Cue_Con_Sam     1.253376 1.11954 
##  Participant.10 Con_Ali_Sam     0.106723 0.32669 
##  Participant.11 Cue_Con_Ali_Sam 0.052783 0.22975 
## Number of obs: 61437, groups:  Participant, 64
## 
## Fixed effects:
##                                                     Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                                         0.133020   0.046193   2.880 0.003981 ** 
## Cue2-1                                              0.088085   0.046163   1.908 0.056376 .  
## Congruency2-1                                      -0.143434   0.015204  -9.434  < 2e-16 ***
## Alignment2-1                                        0.056618   0.027582   2.053 0.040104 *  
## SameDifferent2-1                                   -1.366260   0.059919 -22.802  < 2e-16 ***
## Probability0.5                                      0.042443   0.065206   0.651 0.515106    
## Probability0.75                                     0.030360   0.016168   1.878 0.060405 .  
## Cue2-1:Congruency2-1                               -0.010254   0.025777  -0.398 0.690775    
## Cue2-1:Alignment2-1                                -0.103374   0.035371  -2.923 0.003472 ** 
## Congruency2-1:Alignment2-1                          0.127151   0.023736   5.357 8.47e-08 ***
## Cue2-1:SameDifferent2-1                             0.318680   0.112984   2.821 0.004794 ** 
## Congruency2-1:SameDifferent2-1                      1.032317   0.075768  13.625  < 2e-16 ***
## Alignment2-1:SameDifferent2-1                       0.010682   0.023847   0.448 0.654191    
## Cue2-1:Congruency2-1:Alignment2-1                  -0.002169   0.047379  -0.046 0.963483    
## Cue2-1:Congruency2-1:SameDifferent2-1              -0.078201   0.148731  -0.526 0.599036    
## Cue2-1:Alignment2-1:SameDifferent2-1                0.167813   0.047598   3.526 0.000423 ***
## Congruency2-1:Alignment2-1:SameDifferent2-1        -0.573905   0.063347  -9.060  < 2e-16 ***
## Cue2-1:Congruency2-1:Alignment2-1:SameDifferent2-1  0.632150   0.099361   6.362 1.99e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

4.1.2 Estimated marginal means

4.1.2.1 Estimated marginal means for hit and false alarm

(emm_resp <- emmeans(glmm_resp_opt, ~ Alignment + Congruency + Cue + SameDifferent))
##  Alignment  Congruency  Cue    SameDifferent emmean     SE  df asymp.LCL asymp.UCL
##  aligned    congruent   top    same           1.284 0.0705 Inf     1.146     1.422
##  misaligned congruent   top    same           1.142 0.0698 Inf     1.005     1.279
##  aligned    incongruent top    same           0.323 0.0678 Inf     0.190     0.456
##  misaligned incongruent top    same           0.755 0.0686 Inf     0.620     0.889
##  aligned    congruent   bottom same           1.212 0.0701 Inf     1.075     1.350
##  misaligned congruent   bottom same           1.042 0.0692 Inf     0.907     1.178
##  aligned    incongruent bottom same           0.440 0.0679 Inf     0.306     0.573
##  misaligned incongruent bottom same           0.525 0.0680 Inf     0.391     0.658
##  aligned    congruent   top    different     -0.963 0.0689 Inf    -1.098    -0.828
##  misaligned congruent   top    different     -0.733 0.0683 Inf    -0.867    -0.599
##  aligned    incongruent top    different     -0.408 0.0679 Inf    -0.541    -0.275
##  misaligned incongruent top    different     -0.494 0.0679 Inf    -0.627    -0.361
##  aligned    congruent   bottom different     -0.603 0.0681 Inf    -0.736    -0.470
##  misaligned congruent   bottom different     -0.549 0.0680 Inf    -0.683    -0.416
##  aligned    incongruent bottom different     -0.254 0.0677 Inf    -0.386    -0.121
##  misaligned incongruent bottom different     -0.203 0.0677 Inf    -0.335    -0.070
## 
## Results are averaged over the levels of: Probability 
## Results are given on the probit (not the response) scale. 
## Confidence level used: 0.95

4.1.2.2 Estimated marginal means for d’

emm_d <- contrast(emm_resp, method = "pairwise", simple = "SameDifferent")
summary(emm_d[1:8], infer = c(TRUE, FALSE), adjust = "none")
##  contrast         Alignment  Congruency  Cue    estimate    SE  df asymp.LCL asymp.UCL
##  same - different aligned    congruent   top       2.247 0.103 Inf     2.045     2.449
##  same - different misaligned congruent   top       1.875 0.102 Inf     1.675     2.076
##  same - different aligned    incongruent top       0.731 0.100 Inf     0.534     0.928
##  same - different misaligned incongruent top       1.249 0.101 Inf     1.051     1.447
##  same - different aligned    congruent   bottom    1.815 0.102 Inf     1.615     2.015
##  same - different misaligned congruent   bottom    1.592 0.102 Inf     1.393     1.791
##  same - different aligned    incongruent bottom    0.693 0.100 Inf     0.496     0.890
##  same - different misaligned incongruent bottom    0.727 0.101 Inf     0.530     0.924
## 
## Results are averaged over the levels of: Probability 
## Note: contrasts are still on the probit scale 
## Confidence level used: 0.95
# emmip(emm_d, Congruency ~ Alignment | Cue, CIs = TRUE)
plot_E12_cf_d <- summary(emm_d[1:8], infer = c(TRUE, FALSE), adjust = "sidak") %>% 
  as_tibble() %>% 
  ggplot(aes(y = estimate, x = Alignment, color = Congruency, group = Congruency)) +
  geom_point(position = position_dodge(width = 0.1), size = 2) +
  geom_line(aes(linetype = Congruency), position = position_dodge(width = 0.1),
            size = 0.8) +
  scale_linetype_manual(values=c("solid", "dashed"))+
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0, 
                alpha = .6, position = position_dodge(width = 0.1),
                show.legend = F) + 
  facet_grid(. ~Cue, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_d) +  # set the limit for y axis c(0, 1100)
  labs(x = "Target half", y = expression("Sensitivity"~italic("d'")), fill = "Congruency") +  # set the names for main, x and y axises
  geom_text(label = c("***", "", "", "", "**", "", "", ""), color = "red", size = 6, nudge_y = 0.5, nudge_x = 0.5) + # add starts to the significant columns
  theme_bw() +
  theme(
    text = element_text(size = 10),
    axis.title = element_text(size = 16), 
    axis.text = element_text(size = 14), # the size of the texts in plot
    # axis.text.x = element_text(angle = 45, vjust = 0.5),
    legend.title=element_text(size=15),
    legend.text=element_text(size=14),
    legend.position = "right",
    legend.key.width = unit(1.2, "cm"),
    plot.title = element_text(lineheight=.8, face="bold", size = 17),
    panel.border = element_blank(),
    panel.grid.minor = element_blank(),
    panel.grid.major = element_blank(),
    axis.line.x = element_line(colour = 'black', size=0.5, linetype='solid'),
    axis.line.y = element_line(colour = 'black', size=0.5, linetype='solid'),
    # remove the facet background color
    strip.text = element_text(face="bold", size=14, lineheight=5.0),
    strip.background = element_rect(fill="white", colour="white", size=1),
    strip.placement = "outside"
  ) 

# ggsave(filename = "E12_cf_d.pdf", plot_E12_cf_d, width = 8, height = 4.8)
plot_E12_cf_d

4.1.2.3 Composite effects

Composite face effects for top and bottom parts:

emm_d_cf <- contrast(emm_resp, interaction = "pairwise", by = "Cue")
summary(emm_d_cf[1:2], infer = TRUE)
##  Alignment_pairwise   Congruency_pairwise     SameDifferent_pairwise Cue    estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  aligned - misaligned congruent - incongruent same - different       top       0.890 0.0814 Inf     0.730     1.049  10.936  <.0001
##  aligned - misaligned congruent - incongruent same - different       bottom    0.258 0.0796 Inf     0.102     0.414   3.238  0.0012
## 
## Results are averaged over the levels of: Probability 
## Confidence level used: 0.95
emm_d_con <- contrast(emm_resp, interaction = "pairwise", by = c("Cue", "Alignment"))
summary(emm_d_con[c(1,3)], infer = TRUE)
##  Congruency_pairwise     SameDifferent_pairwise Cue    Alignment estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  congruent - incongruent same - different       top    aligned       1.52 0.114 Inf      1.29      1.74  13.278  <.0001
##  congruent - incongruent same - different       bottom aligned       1.12 0.113 Inf      0.90      1.34   9.902  <.0001
## 
## Results are averaged over the levels of: Probability 
## Confidence level used: 0.95

4.1.2.4 Facilitation and interference

# Sensitivity d'
emm_d_fi <- contrast(emm_resp, interaction = "pairwise", by = c("Cue", "Congruency"), adjust = "sidak")
summary(emm_d_fi[1:4], infer=TRUE)
##  Alignment_pairwise   SameDifferent_pairwise Cue    Congruency  estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  aligned - misaligned same - different       top    congruent     0.3718 0.0561 Inf    0.2321    0.5114   6.631  <.0001
##  aligned - misaligned same - different       top    incongruent  -0.5182 0.0500 Inf   -0.6429   -0.3936 -10.357  <.0001
##  aligned - misaligned same - different       bottom congruent     0.2235 0.0542 Inf    0.0884    0.3586   4.122  0.0002
##  aligned - misaligned same - different       bottom incongruent  -0.0343 0.0493 Inf   -0.1572    0.0886  -0.696  0.9305
## 
## Results are averaged over the levels of: Probability 
## Confidence level used: 0.95 
## Conf-level adjustment: sidak method for 4 estimates 
## P value adjustment: sidak method for 4 tests
# showing the differences between aligned and misaligned (aligned-misaligned)
# emmip(emm_d_fi[1:4], ~ Cue | Congruency, CIs = TRUE, adjust = "sidak") +
#   geom_hline(yintercept = 0, linetype = "dashed")
plot_E12_cffi_d <- summary(emm_d_fi[1:4], infer=TRUE) %>% 
  as_tibble() %>% 
  ggplot(aes(y = estimate, x = Cue, color = Congruency)) +
  geom_point(size = 2) +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0, 
                alpha = .6) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  facet_grid(. ~ Congruency, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_fi_d) +  # set the limit for y axis c(0, 1100)
  labs(x = "Congruency", y = expression(italic("d'")~"(aligned-misaligned)")) +  # set the names for main, x and y axises
  theme_bw() +
  theme(
    text = element_text(size = 10),
    axis.title = element_text(size = 16), 
    axis.text = element_text(size = 14), # the size of the texts in plot
    # axis.text.x = element_text(angle = 45, vjust = 0.5),
    legend.title=element_text(size=15),
    legend.text=element_text(size=14),
    legend.position = "none",
    legend.key.width = unit(1.2, "cm"),
    plot.title = element_text(lineheight=.8, face="bold", size = 17),
    panel.border = element_blank(),
    panel.grid.minor = element_blank(),
    panel.grid.major = element_blank(),
    axis.line.x = element_line(colour = 'black', size=0.5, linetype='solid'),
    axis.line.y = element_line(colour = 'black', size=0.5, linetype='solid'),
    # remove the facet background color
    strip.text = element_text(face="bold", size=14, lineheight=5.0),
    strip.background = element_rect(fill="white", colour="white", size=1),
    strip.placement = "outside"
  ) +
  NULL

# ggsave(filename = "E12_fi_d.pdf", plot_E12_cffi_d, width = 7, height = 4.55)
plot_E12_cffi_d

plot_E12_cf_d_ <- plot_E12_cf_d +
  guides(color = guide_legend(nrow = 1, title.position = "left"), 
         linetype = guide_legend(nrow = 1, title.position = "left")) +
  theme(legend.position = c(0.6, 0.075),
        legend.box = "horizontal") 

plot_E12_d <- ggarrange(plot_E12_cf_d_, plot_E12_cffi_d, 
                       labels = c("A", "B"),
                       font.label = (list(size = 20)),
                       widths = c(1.5, 1),
                       nrow = 1)

# ggsave(filename = "E12_d.pdf", plot_E12_d, width = 10, height = 4.5)
plot_E12_d

4.1.2.5 Comparisons between facilitation and interference

contrast(emm_d_fi, method = list("faci-inte"=c(1, 1)), by = "Cue")[1:2] %>% 
  summary(infer = TRUE)
##  contrast  Cue    estimate     SE  df asymp.LCL asymp.UCL z.ratio p.value
##  faci-inte top      -0.146 0.0684 Inf    -0.280   -0.0125  -2.142  0.0322
##  faci-inte bottom    0.189 0.0664 Inf     0.059    0.3193   2.849  0.0044
## 
## Results are averaged over the levels of: Probability 
## Confidence level used: 0.95

4.2 Response times

df_lmm_rt <- df_lmm %>% 
  filter(isCorrect == 1)

# save(df_lmm_rt, file = file.path("data", "df_lmm_rt.RData"))

4.2.1 Fitting the generalized mixed models

with log-transformation. #### The maximal model

# file_rt_max <- file.path(folder_lmm, "rt_lmm_max.RData")
# 
# # fit the max model
# if (!file.exists(file_rt_max)) {
#   glmm_rt_max <- glmer(
#     log(RT) ~ Cue * Congruency * Alignment + Probability +
#       (Cue * Congruency * Alignment | Participant), 
#     family = lognormal(),
#     data = df_lmm_rt,
#     control = glmerControl(optimizer = "optimx", # calc.derivs = FALSE,
#                            optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
#   )
# 
#   save(glmm_rt_max, file = file_rt_max)
# } else {
#   load(file_rt_max)
# }
# 
# print(summary(glmm_rt_max), corr = FALSE)

4.2.1.1 The zero-correlation-parameter model

file_rt_zcp <- file.path(folder_lmm, "rt_lmm_zcp.RData")

# fit the zcp1 model
if (!file.exists(file_rt_zcp)) {
  glmm_rt_zcp <- lmer(
    log(RT) ~ Cue * Congruency * Alignment + Probability + 
      (Cue_C + Con_C + Ali_C + 
         Cue_Con + Cue_Ali + Con_Ali + 
         Cue_Con_Ali || Participant),
    data = df_lmm_rt,
    control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                          optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
    # save(glmm_rt_zcp, file = file_rt_zcp)
} else {
    load(file_rt_zcp)
}

print(summary(glmm_rt_zcp), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + Probability + (Cue_C +      Con_C + Ali_C + Cue_Con + Cue_Ali + Con_Ali + Cue_Con_Ali ||      Participant)
##    Data: df_lmm_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
## REML criterion at convergence: 37568.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.0118 -0.6012 -0.1452  0.4415  9.7535 
## 
## Random effects:
##  Groups        Name        Variance  Std.Dev. 
##  Participant   (Intercept) 5.531e-02 2.352e-01
##  Participant.1 Cue_C       2.039e-02 1.428e-01
##  Participant.2 Con_C       6.458e-04 2.541e-02
##  Participant.3 Ali_C       7.453e-04 2.730e-02
##  Participant.4 Cue_Con     7.533e-04 2.745e-02
##  Participant.5 Cue_Ali     8.167e-05 9.037e-03
##  Participant.6 Con_Ali     3.866e-11 6.217e-06
##  Participant.7 Cue_Con_Ali 5.132e-03 7.164e-02
##  Residual                  1.334e-01 3.653e-01
## Number of obs: 44710, groups:  Participant, 64
## 
## Fixed effects:
##                                     Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                        6.678e+00  4.171e-02  6.221e+01 160.114  < 2e-16 ***
## Cue2-1                             3.909e-02  1.830e-02  6.350e+01   2.136  0.03651 *  
## Congruency2-1                      3.524e-02  4.819e-03  5.487e+01   7.314 1.17e-09 ***
## Alignment2-1                       1.469e-02  4.964e-03  5.570e+01   2.959  0.00452 ** 
## Probability0.5                     8.884e-02  5.897e-02  6.216e+01   1.507  0.13698    
## Probability0.75                    1.024e-02  5.087e-03  4.364e+04   2.013  0.04407 *  
## Cue2-1:Congruency2-1               4.223e-03  7.913e-03  5.078e+01   0.534  0.59592    
## Cue2-1:Alignment2-1               -2.254e-03  7.082e-03  3.155e+01  -0.318  0.75234    
## Congruency2-1:Alignment2-1        -4.508e-02  6.976e-03  3.982e+04  -6.463 1.04e-10 ***
## Cue2-1:Congruency2-1:Alignment2-1 -1.414e-02  1.681e-02  3.807e+01  -0.841  0.40551    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular

4.2.1.2 The reduced model

summary(rePCA(glmm_rt_zcp))
## $Participant
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]    [,5]    [,6]    [,7]      [,8]
## Standard deviation     0.6438 0.3909 0.19612 0.07514 0.07474 0.06957 0.02474 1.702e-05
## Proportion of Variance 0.6660 0.2455 0.06179 0.00907 0.00897 0.00778 0.00098 0.000e+00
## Cumulative Proportion  0.6660 0.9114 0.97320 0.98227 0.99124 0.99902 1.00000 1.000e+00

Con_Ali, and Cue_Ali were removed from extended model (glmm_rt_zcp) due to that the variances they explained were smaller than 0.1%, making glmm_rt_rdc.

file_rt_rdc <- file.path(folder_lmm, "rt_lmm_rdc.RData")

# fit the zcp model
# three random effects were removed
if (!file.exists(file_rt_rdc)) {
  glmm_rt_rdc <- lmer(
    log(RT) ~ Cue * Congruency * Alignment + Probability + 
      (Cue_C + Con_C + Ali_C + 
         Cue_Con +  # Con_Ali + Cue_Ali +
         Cue_Con_Ali || Participant),
    data = df_lmm_rt,
    control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                          optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_rt_rdc, file = file_rt_rdc)
} else {
  load(file_rt_rdc)
}

print(summary(glmm_rt_rdc), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + Probability + (Cue_C +      Con_C + Ali_C + Cue_Con + Cue_Con_Ali || Participant)
##    Data: df_lmm_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
## REML criterion at convergence: 37568.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.0114 -0.6010 -0.1454  0.4413  9.7530 
## 
## Random effects:
##  Groups        Name        Variance  Std.Dev.
##  Participant   (Intercept) 0.0553065 0.23517 
##  Participant.1 Cue_C       0.0203864 0.14278 
##  Participant.2 Con_C       0.0006454 0.02540 
##  Participant.3 Ali_C       0.0007437 0.02727 
##  Participant.4 Cue_Con     0.0007531 0.02744 
##  Participant.5 Cue_Con_Ali 0.0051144 0.07151 
##  Residual                  0.1334233 0.36527 
## Number of obs: 44710, groups:  Participant, 64
## 
## Fixed effects:
##                                     Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                        6.678e+00  4.171e-02  6.221e+01 160.114  < 2e-16 ***
## Cue2-1                             3.910e-02  1.830e-02  6.350e+01   2.136  0.03651 *  
## Congruency2-1                      3.524e-02  4.818e-03  5.488e+01   7.315 1.16e-09 ***
## Alignment2-1                       1.468e-02  4.961e-03  5.586e+01   2.959  0.00452 ** 
## Probability0.5                     8.884e-02  5.897e-02  6.216e+01   1.507  0.13700    
## Probability0.75                    1.024e-02  5.087e-03  4.369e+04   2.013  0.04411 *  
## Cue2-1:Congruency2-1               4.227e-03  7.913e-03  5.079e+01   0.534  0.59555    
## Cue2-1:Alignment2-1               -2.343e-03  6.978e-03  4.357e+04  -0.336  0.73703    
## Congruency2-1:Alignment2-1        -4.510e-02  6.975e-03  4.236e+04  -6.465 1.02e-10 ***
## Cue2-1:Congruency2-1:Alignment2-1 -1.414e-02  1.680e-02  3.814e+01  -0.841  0.40538    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

4.2.1.3 The extended model

file_rt_etd <- file.path(folder_lmm, "rt_lmm_etd.RData")

# fit the etd model
if (!file.exists(file_rt_etd)) {
   glmm_rt_etd <- lmer(
    log(RT) ~ Cue * Congruency * Alignment + Probability + 
      (Cue_C + Con_C + Ali_C + 
         Cue_Con +  # Con_Ali + Cue_Ali +
         Cue_Con_Ali | Participant),
    data = df_lmm_rt,
    control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                          optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_rt_etd, file = glmm_rt_etd)
} else {
  load(file_rt_etd)
}

print(summary(glmm_rt_etd), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + Probability + (Cue_C +      Con_C + Ali_C + Cue_Con + Cue_Con_Ali | Participant)
##    Data: df_lmm_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
## REML criterion at convergence: 37540.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.0149 -0.6012 -0.1444  0.4431  9.7665 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev. Corr                         
##  Participant (Intercept) 0.0550740 0.23468                               
##              Cue_C       0.0203309 0.14259  -0.07                        
##              Con_C       0.0006861 0.02619  -0.14  0.45                  
##              Ali_C       0.0008223 0.02868  -0.08 -0.12  0.31            
##              Cue_Con     0.0011893 0.03449   0.17  0.24  0.03 -0.72      
##              Cue_Con_Ali 0.0054717 0.07397  -0.72  0.11 -0.37 -0.10 -0.37
##  Residual                0.1333885 0.36522                               
## Number of obs: 44710, groups:  Participant, 64
## 
## Fixed effects:
##                                     Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                        6.672e+00  3.986e-02  6.803e+01 167.402  < 2e-16 ***
## Cue2-1                             3.912e-02  1.828e-02  6.342e+01   2.140  0.03618 *  
## Congruency2-1                      3.621e-02  4.867e-03  5.542e+01   7.440 6.88e-10 ***
## Alignment2-1                       1.471e-02  5.075e-03  5.567e+01   2.898  0.00537 ** 
## Probability0.5                     1.002e-01  5.378e-02  6.300e+01   1.863  0.06707 .  
## Probability0.75                    1.010e-02  5.085e-03  4.336e+04   1.986  0.04707 *  
## Cue2-1:Congruency2-1               4.786e-03  8.328e-03  5.356e+01   0.575  0.56789    
## Cue2-1:Alignment2-1               -2.922e-03  6.971e-03  4.343e+04  -0.419  0.67507    
## Congruency2-1:Alignment2-1        -4.461e-02  6.965e-03  4.312e+04  -6.404 1.53e-10 ***
## Cue2-1:Congruency2-1:Alignment2-1 -1.339e-02  1.693e-02  5.914e+01  -0.791  0.43230    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1 
## Model failed to converge with max|grad| = 0.0169721 (tol = 0.002, component 1)
file_rt_etd1 <- file.path(folder_lmm, "rt_lmm_etd1.RData")

# fit the etd1 model
if (!file.exists(file_rt_etd1)) {
  ss <- getME(glmm_rt_etd, c("theta","fixef"))
  glmm_rt_etd1 <- update(
    glmm_rt_etd, start=ss,
    control=lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                         optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE)))
} else {
  load(file_rt_etd1)
}

print(summary(glmm_rt_etd1), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + Probability + (Cue_C +      Con_C + Ali_C + Cue_Con + Cue_Con_Ali | Participant)
##    Data: df_lmm_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
## REML criterion at convergence: 37540.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.0149 -0.6012 -0.1445  0.4431  9.7665 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev. Corr                         
##  Participant (Intercept) 0.0550740 0.23468                               
##              Cue_C       0.0203296 0.14258  -0.07                        
##              Con_C       0.0006850 0.02617  -0.14  0.45                  
##              Ali_C       0.0008217 0.02867  -0.08 -0.12  0.31            
##              Cue_Con     0.0011887 0.03448   0.17  0.24  0.03 -0.72      
##              Cue_Con_Ali 0.0054717 0.07397  -0.72  0.11 -0.37 -0.10 -0.37
##  Residual                0.1333887 0.36522                               
## Number of obs: 44710, groups:  Participant, 64
## 
## Fixed effects:
##                                     Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                        6.672e+00  3.986e-02  6.803e+01 167.400  < 2e-16 ***
## Cue2-1                             3.912e-02  1.828e-02  6.343e+01   2.140  0.03617 *  
## Congruency2-1                      3.621e-02  4.865e-03  5.547e+01   7.442 6.78e-10 ***
## Alignment2-1                       1.470e-02  5.074e-03  5.570e+01   2.898  0.00536 ** 
## Probability0.5                     1.002e-01  5.378e-02  6.299e+01   1.863  0.06711 .  
## Probability0.75                    1.010e-02  5.085e-03  4.336e+04   1.986  0.04707 *  
## Cue2-1:Congruency2-1               4.786e-03  8.327e-03  5.357e+01   0.575  0.56791    
## Cue2-1:Alignment2-1               -2.922e-03  6.971e-03  4.343e+04  -0.419  0.67505    
## Congruency2-1:Alignment2-1        -4.461e-02  6.965e-03  4.312e+04  -6.404 1.53e-10 ***
## Cue2-1:Congruency2-1:Alignment2-1 -1.339e-02  1.693e-02  5.914e+01  -0.791  0.43222    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (optimx) convergence code: 1 
## Model failed to converge with max|grad| = 0.0167706 (tol = 0.002, component 1)
summary(rePCA(glmm_rt_etd1))
## $Participant
## Importance of components:
##                          [,1]   [,2]    [,3]    [,4]    [,5]      [,6]
## Standard deviation     0.6608 0.3912 0.15145 0.11135 0.03757 0.0008193
## Proportion of Variance 0.6970 0.2443 0.03661 0.01979 0.00225 0.0000000
## Cumulative Proportion  0.6970 0.9414 0.97796 0.99775 1.00000 1.0000000

Con_C and Ali_C were removed from extended model (glmm_resp_etd1) due to that the variances they explained were smaller than 1%, making glmm_resp_etd2.

file_rt_etd2 <- file.path(folder_lmm, "rt_lmm_etd2.RData")

# fit the etd2 model
if (!file.exists(file_rt_etd2)) {
  glmm_rt_etd2 <- lmer(
    log(RT) ~ Cue * Congruency * Alignment + Probability + 
      (Cue_C + # Con_C + Ali_C + 
         Cue_Con +  # Con_Ali + Cue_Ali +
         Cue_Con_Ali | Participant),
    data = df_lmm_rt,
    control = lmerControl(optimizer = "optimx", # calc.derivs = FALSE,
                          optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE))
  )
  # save(glmm_rt_etd2, file = file_rt_etd2)
} else {
  load(file_rt_etd2)
}

print(summary(glmm_rt_etd2), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + Probability + (Cue_C +      Cue_Con + Cue_Con_Ali | Participant)
##    Data: df_lmm_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
## REML criterion at convergence: 37587.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.9925 -0.6004 -0.1446  0.4413  9.7582 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev. Corr             
##  Participant (Intercept) 0.0552105 0.23497                   
##              Cue_C       0.0203947 0.14281  -0.07            
##              Cue_Con     0.0007303 0.02702   0.14  0.27      
##              Cue_Con_Ali 0.0048203 0.06943  -0.77  0.09 -0.49
##  Residual                0.1337601 0.36573                   
## Number of obs: 44710, groups:  Participant, 64
## 
## Fixed effects:
##                                     Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                        6.674e+00  4.004e-02  6.743e+01 166.698  < 2e-16 ***
## Cue2-1                             3.916e-02  1.830e-02  6.344e+01   2.139   0.0363 *  
## Congruency2-1                      3.514e-02  3.508e-03  3.876e+04  10.017  < 2e-16 ***
## Alignment2-1                       1.379e-02  3.483e-03  4.367e+04   3.961 7.48e-05 ***
## Probability0.5                     9.634e-02  5.422e-02  6.218e+01   1.777   0.0805 .  
## Probability0.75                    1.030e-02  5.092e-03  4.368e+04   2.023   0.0431 *  
## Cue2-1:Congruency2-1               4.982e-03  7.858e-03  4.983e+01   0.634   0.5290    
## Cue2-1:Alignment2-1               -2.427e-03  6.965e-03  4.418e+04  -0.348   0.7275    
## Congruency2-1:Alignment2-1        -4.614e-02  6.968e-03  4.154e+04  -6.622 3.58e-11 ***
## Cue2-1:Congruency2-1:Alignment2-1 -1.371e-02  1.663e-02  3.757e+01  -0.824   0.4149    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

4.2.1.4 The optimal model

# compare the extended and reduced model
anova(glmm_rt_etd2, glmm_rt_rdc, refit = FALSE)
## Data: df_lmm_rt
## Models:
## glmm_rt_rdc: log(RT) ~ Cue * Congruency * Alignment + Probability + (Cue_C + 
## glmm_rt_rdc:     Con_C + Ali_C + Cue_Con + Cue_Con_Ali || Participant)
## glmm_rt_etd2: log(RT) ~ Cue * Congruency * Alignment + Probability + (Cue_C + 
## glmm_rt_etd2:     Cue_Con + Cue_Con_Ali | Participant)
##              npar   AIC   BIC logLik deviance Chisq Df Pr(>Chisq)
## glmm_rt_rdc    17 37602 37750 -18784    37568                    
## glmm_rt_etd2   21 37629 37812 -18794    37587     0  4          1

According to BIC, the reduced model (glmm_resp_rdc) explained the data better than the extended model (glmm_resp_etd2) and, therefore, the reduced model is used as the optimal model.

glmm_rt_opt <- glmm_rt_rdc

print(summary(glmm_rt_opt), corr = FALSE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: log(RT) ~ Cue * Congruency * Alignment + Probability + (Cue_C +      Con_C + Ali_C + Cue_Con + Cue_Con_Ali || Participant)
##    Data: df_lmm_rt
## Control: lmerControl(optimizer = "optimx", optCtrl = list(method = "nlminb",      starttests = FALSE, kkt = FALSE))
## 
## REML criterion at convergence: 37568.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.0114 -0.6010 -0.1454  0.4413  9.7530 
## 
## Random effects:
##  Groups        Name        Variance  Std.Dev.
##  Participant   (Intercept) 0.0553065 0.23517 
##  Participant.1 Cue_C       0.0203864 0.14278 
##  Participant.2 Con_C       0.0006454 0.02540 
##  Participant.3 Ali_C       0.0007437 0.02727 
##  Participant.4 Cue_Con     0.0007531 0.02744 
##  Participant.5 Cue_Con_Ali 0.0051144 0.07151 
##  Residual                  0.1334233 0.36527 
## Number of obs: 44710, groups:  Participant, 64
## 
## Fixed effects:
##                                     Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                        6.678e+00  4.171e-02  6.221e+01 160.114  < 2e-16 ***
## Cue2-1                             3.910e-02  1.830e-02  6.350e+01   2.136  0.03651 *  
## Congruency2-1                      3.524e-02  4.818e-03  5.488e+01   7.315 1.16e-09 ***
## Alignment2-1                       1.468e-02  4.961e-03  5.586e+01   2.959  0.00452 ** 
## Probability0.5                     8.884e-02  5.897e-02  6.216e+01   1.507  0.13700    
## Probability0.75                    1.024e-02  5.087e-03  4.369e+04   2.013  0.04411 *  
## Cue2-1:Congruency2-1               4.227e-03  7.913e-03  5.079e+01   0.534  0.59555    
## Cue2-1:Alignment2-1               -2.343e-03  6.978e-03  4.357e+04  -0.336  0.73703    
## Congruency2-1:Alignment2-1        -4.510e-02  6.975e-03  4.236e+04  -6.465 1.02e-10 ***
## Cue2-1:Congruency2-1:Alignment2-1 -1.414e-02  1.680e-02  3.814e+01  -0.841  0.40538    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

4.2.2 Estimated marginal means

4.2.2.1 Estimated marginal means for RT

file_rt_emm <- file.path(folder_lmm, "rt_emm.RData") 
if (!file.exists(file_rt_emm)) {
  emm_rt <- emmeans(glmm_rt_opt, ~ Cue + Congruency + Alignment)
} else {
  load(file_rt_emm)
}

summary(emm_rt, type = "response") # equivalent to regrid(emm_rt)
##  Cue    Congruency  Alignment  response   SE  df asymp.LCL asymp.UCL
##  top    congruent   aligned         778 25.5 Inf       730       830
##  bottom congruent   aligned         806 26.4 Inf       756       859
##  top    incongruent aligned         820 26.9 Inf       769       874
##  bottom incongruent aligned         859 28.2 Inf       805       916
##  top    congruent   misaligned      806 26.4 Inf       756       859
##  bottom congruent   misaligned      838 27.4 Inf       786       894
##  top    incongruent misaligned      817 26.8 Inf       767       872
##  bottom incongruent misaligned      848 27.8 Inf       795       904
## 
## Results are averaged over the levels of: Probability 
## Degrees-of-freedom method: asymptotic 
## Confidence level used: 0.95 
## Intervals are back-transformed from the log scale
# emmip(regrid(emm_rt), Congruency ~ Alignment | Cue, CIs = TRUE)
plot_E12_cf_rt <- summary(emm_rt, type = "response") %>% 
  as_tibble() %>% 
  ggplot(aes(y = response, x = Alignment, color = Congruency, group = Congruency)) +
  geom_point(position = position_dodge(width = 0.1), size = 2) +
  geom_line(aes(linetype = Congruency), position = position_dodge(width = 0.1),
            size = 0.8) +
  scale_linetype_manual(values=c("solid", "dashed"))+
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0, 
                alpha = .6, position = position_dodge(width = 0.1),
                show.legend = F) + 
  facet_grid(. ~Cue, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_rt) +  # set the limit for y axis c(0, 1100)
  labs(x = "Target half", y = "Correct response times (ms)", fill = "Congruency") +  # set the names for main, x and y axises
  geom_text(label = c("", "", "***", "***", "", "", "", ""), color = "red", size = 6, nudge_y = 50, nudge_x = 0.5) + # add starts to the significant columns
  theme_bw() +
  theme(
    text = element_text(size = 10),
    axis.title = element_text(size = 16), 
    axis.text = element_text(size = 14), # the size of the texts in plot
    # axis.text.x = element_text(angle = 45, vjust = 0.5),
    legend.title=element_text(size=15),
    legend.text=element_text(size=14),
    legend.position = "right",
    legend.key.width = unit(1.2, "cm"),
    plot.title = element_text(lineheight=.8, face="bold", size = 17),
    panel.border = element_blank(),
    panel.grid.minor = element_blank(),
    panel.grid.major = element_blank(),
    axis.line.x = element_line(colour = 'black', size=0.5, linetype='solid'),
    axis.line.y = element_line(colour = 'black', size=0.5, linetype='solid'),
    # remove the facet background color
    strip.text = element_text(face="bold", size=14, lineheight=5.0),
    strip.background = element_rect(fill="white", colour="white", size=1),
    strip.placement = "outside"
  ) 

# ggsave(filename = "E12_cf_rt.pdf", plot_E12_cf_rt, width = 8, height = 4.8)
plot_E12_cf_rt

4.2.2.2 Composite effects

Composite face effects for top and bottom parts:

emm_rt_cf <- contrast(regrid(emm_rt), interaction = "pairwise", by = "Cue", infer = TRUE)
emm_rt_cf[1:2]
##  Congruency_pairwise     Alignment_pairwise   Cue    estimate   SE  df asymp.LCL asymp.UCL z.ratio p.value
##  congruent - incongruent aligned - misaligned top       -30.2 8.76 Inf     -47.4     -13.0  -3.447  0.0006
##  congruent - incongruent aligned - misaligned bottom    -43.3 9.37 Inf     -61.6     -24.9  -4.616  <.0001
## 
## Results are averaged over the levels of: Probability 
## Confidence level used: 0.95
# emmip(emm_rt_cf[1:2], ~ Cue , CIs = TRUE) +
#   geom_hline(yintercept = 0, linetype = "dashed")
emm_rt_con <- contrast(regrid(emm_rt), interaction = "pairwise", by = c("Cue", "Alignment"))
summary(emm_rt_con[c(1,2)], infer = TRUE)
##  Congruency_pairwise     Cue    Alignment estimate   SE  df asymp.LCL asymp.UCL z.ratio p.value
##  congruent - incongruent top    aligned      -41.7 6.75 Inf     -54.9     -28.4  -6.168  <.0001
##  congruent - incongruent bottom aligned      -52.8 7.19 Inf     -66.9     -38.7  -7.344  <.0001
## 
## Results are averaged over the levels of: Probability 
## Confidence level used: 0.95

4.2.2.3 Facilitation and interference

emm_rt_fi <- contrast(regrid(emm_rt), "pairwise", by = c("Cue", "Congruency"), infer=TRUE, adjust = "sidak")
emm_rt_fi[1:4]
##  contrast             Cue    Congruency  estimate   SE  df asymp.LCL asymp.UCL z.ratio p.value
##  aligned - misaligned top    congruent     -27.62 6.22 Inf    -43.11     -12.1  -4.440  <.0001
##  aligned - misaligned bottom congruent     -32.54 6.59 Inf    -48.96     -16.1  -4.935  <.0001
##  aligned - misaligned top    incongruent     2.59 6.85 Inf    -14.48      19.7   0.378  0.9925
##  aligned - misaligned bottom incongruent    10.73 7.32 Inf     -7.49      28.9   1.466  0.4594
## 
## Results are averaged over the levels of: Probability 
## Confidence level used: 0.95 
## Conf-level adjustment: sidak method for 4 estimates 
## P value adjustment: sidak method for 4 tests
# emmip(emm_rt_fi[1:4], ~ Cue | Congruency, CIs = TRUE, adjust = "sidak") +
#   geom_hline(yintercept = 0, linetype = "dashed")
plot_E12_cffi_rt <- emm_rt_fi[1:4] %>% 
  as_tibble() %>% 
  ggplot(aes(y = estimate, x = Cue, color = Congruency)) +
  geom_point(size = 2) +
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL), size=1.5, width=0, 
                alpha = .6) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  facet_grid(. ~ Congruency, switch = "both") +
  coord_cartesian(ylim = ylimit_cf_fi_rt) +  # set the limit for y axis c(0, 1100)
  labs(x = "Congruency", y = expression(RT~"(aligned-misaligned)")) +  # set the names for main, x and y axises
  theme_bw() +
  theme(
    text = element_text(size = 10),
    axis.title = element_text(size = 16), 
    axis.text = element_text(size = 14), # the size of the texts in plot
    # axis.text.x = element_text(angle = 45, vjust = 0.5),
    legend.title=element_text(size=15),
    legend.text=element_text(size=14),
    legend.position = "none",
    legend.key.width = unit(1.2, "cm"),
    plot.title = element_text(lineheight=.8, face="bold", size = 17),
    panel.border = element_blank(),
    panel.grid.minor = element_blank(),
    panel.grid.major = element_blank(),
    axis.line.x = element_line(colour = 'black', size=0.5, linetype='solid'),
    axis.line.y = element_line(colour = 'black', size=0.5, linetype='solid'),
    # remove the facet background color
    strip.text = element_text(face="bold", size=14, lineheight=5.0),
    strip.background = element_rect(fill="white", colour="white", size=1),
    strip.placement = "outside"
  ) +
  NULL

# ggsave(filename = "E12_fi_rt.pdf", plot_E12_cffi_rt, width = 7, height = 4.55)
plot_E12_cffi_rt

plot_E12_cf_rt_ <- plot_E12_cf_rt +
  guides(color = guide_legend(nrow = 1, title.position = "left"), 
         linetype = guide_legend(nrow = 1, title.position = "left")) +
  theme(legend.position = c(0.55, 0.075),
        legend.box = "horizontal") 

plot_E12_rt <- ggarrange(plot_E12_cf_rt_, plot_E12_cffi_rt, 
                       labels = c("A", "B"),
                       font.label = (list(size = 20)),
                       widths = c(1.5, 1),
                       nrow = 1)

# ggsave(filename = "E12_rt.pdf", plot_E12_rt, width = 10, height = 4.5)
plot_E12_rt

4.2.2.4 Comparisons between facilitation and interference

contrast(emm_rt_fi, method = list("faci-inte"=c(1, 1)), by = "Cue")[1:2] %>% 
  summary(infer = TRUE)
##  contrast  Cue    estimate    SE  df asymp.LCL asymp.UCL z.ratio p.value
##  faci-inte top       -25.0  9.72 Inf     -44.1     -5.97  -2.574  0.0100
##  faci-inte bottom    -21.8 10.30 Inf     -42.0     -1.62  -2.118  0.0342
## 
## Results are averaged over the levels of: Probability 
## Confidence level used: 0.95

5 Plots for publication

5.1 Experiment 1

plot_E1 <- ggarrange(plot_E1_cf_d_, plot_E1_cffi_d, 
                     plot_E1_cf_rt_, plot_E1_cffi_rt,
                     labels = c("A", "B", "C", "D"),
                     font.label = (list(size = 20)),
                     widths = c(1.5, 1),
                     nrow = 2, ncol = 2)
# ggsave(filename = "E1.pdf", plot_E1, width = 10, height = 9)
plot_E1

5.2 Experiment 2

plot_E2 <- ggarrange(plot_E2_cf_d_, plot_E2_cffi_d, 
                     plot_E2_cf_rt_, plot_E2_cffi_rt,
                     labels = c("A", "B", "C", "D"),
                     font.label = (list(size = 20)),
                     widths = c(1.5, 1),
                     nrow = 2, ncol = 2)
# ggsave(filename = "E2.pdf", plot_E2, width = 10, height = 14)
plot_E2

5.3 Experiment 1&2

plot_E12 <- ggarrange(plot_E12_cf_d_, plot_E12_cffi_d, 
                     plot_E12_cf_rt_, plot_E12_cffi_rt,
                     labels = c("A", "B", "C", "D"),
                     font.label = (list(size = 20)),
                     widths = c(1.5, 1),
                     nrow = 2, ncol = 2)
# ggsave(filename = "E12.pdf", plot_E12, width = 10, height = 9)
plot_E12

Session information

sessionInfo()
## R version 4.0.5 (2021-03-31)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Mojave 10.14.5
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] ggpubr_0.4.0    emmeans_1.6.3   optimx_2020-4.2 lmerTest_3.1-3  lme4_1.1-26     Matrix_1.3-2    readxl_1.3.1    forcats_0.5.1   stringr_1.4.0   dplyr_1.0.5     purrr_0.3.4     readr_1.4.0     tidyr_1.1.3     tibble_3.1.1    ggplot2_3.3.5   tidyverse_1.3.1
## 
## loaded via a namespace (and not attached):
##  [1] nlme_3.1-152        fs_1.5.0            lubridate_1.7.10    httr_1.4.2          numDeriv_2016.8-1.1 tools_4.0.5         backports_1.2.1     utf8_1.2.1          R6_2.5.0            DBI_1.1.0           colorspace_1.4-1    withr_2.4.2         tidyselect_1.1.0    curl_4.3.1          compiler_4.0.5      cli_2.5.0           rvest_1.0.0         xml2_1.3.2          labeling_0.4.2      scales_1.1.1        mvtnorm_1.1-1       digest_0.6.27       foreign_0.8-81      minqa_1.2.4         rmarkdown_2.7       rio_0.5.26          pkgconfig_2.0.3     htmltools_0.5.1.1   highr_0.9           dbplyr_2.1.1        rlang_0.4.11        rstudioapi_0.13     farver_2.0.3        generics_0.1.0      jsonlite_1.7.2      zip_2.1.1           car_3.0-10          magrittr_2.0.1      Rcpp_1.0.6          munsell_0.5.0       fansi_0.4.2         abind_1.4-5         lifecycle_1.0.0     stringi_1.6.1       yaml_2.2.1          carData_3.0-4       MASS_7.3-53.1       plyr_1.8.6          grid_4.0.5          crayon_1.4.1        lattice_0.20-41     cowplot_1.1.1       haven_2.3.1         splines_4.0.5       hms_1.0.0           knitr_1.33          pillar_1.6.0        uuid_0.1-4          boot_1.3-27         estimability_1.3    ggsignif_0.6.1      reprex_2.0.0        glue_1.4.2          evaluate_0.14       data.table_1.14.0   modelr_0.1.8        vctrs_0.3.8         nloptr_1.2.2.2      cellranger_1.1.0    gtable_0.3.0        assertthat_0.2.1    xfun_0.22           openxlsx_4.2.3      xtable_1.8-4       
## [75] broom_0.7.6         coda_0.19-4         rstatix_0.7.0       statmod_1.4.35      ellipsis_0.3.2      xaringanExtra_0.4.0